I am using Runtime.getRuntime().exec() to run a shell script from java code.
String[] cmd = {\"sh\", \"build.sh\", \"/Path/to my/sh file\"};
try{
Use a ProcessBuilder and set the working directory of the process to the directory where your script actually is:
final ProcessBuilder pb = new ProcessBuilder("/bin/sh", "script.sh", "whatever",
"arguments", "go", "here");
pb.directory(new File("/path/to/directory"));
// redirect stdout, stderr, etc
final Process p = pb.start();
See the ProcessBuilder javadoc. It contains an example of what you can do. Runtime.exec() is passé :p