I am Executing Shell scripts in Java Using Cygwin. My Scripts are running fine at command prompt, and even if I try simple shell scripts through Java it works fine.
But now my scripts are using another shell scripts from the folder called lib
So I need to include lib folder into my project.
Can any one suggest the way how to include shell script as a part of Java project.
Lib Folder–>
- lib/lib.sh
- lib/paxus.sh
- lib/preload.sh
- lib/tgzcreator.sh
- lib/specific.sh
InSide Lib Folder these are the Shell scripts. Which my_script.sh is using.
Edit:- I want to add Shell script inside my project which uses Command line arguments and some other scripts from above folder structure.
cmd = "D:/cygwin/bin/bash -c '/bin/my_script.sh 121 121 1212 12121'";
Help me for Doing this.
If you are using maven as a build tool the best solution is to add scripts under
/src/main/resources. In this case the scripts will be automatically included into your jar file, so you will be able to extract them on the fly from your java code and run.If you want to have the scripts separately you suggested good solution. I mean
libfolder. But again since I am using maven I’d put them under/src/main/sh(exactly as I put my java files under/src/main/java)