How to run the Shell Script from external directory using java?

Hi,

I have created a Shell Script and invoke through java using Process Builder

It's working fine, if (Shell script file ) in the same directory as java file.

By Problem:

      How to run the Shell Script file\( resides in external directory\) using java. What configuration i have to do in java.

Please Suggest me,

Thank you and Regards,
Nanthagopal A

How about giving absolute path of your shell script as argument to ProcessBuilder class?

Process p = new ProcessBuilder("myCommand", "myArg").start();
Process p = new ProcessBuilder("/bin/bash", "/your_script_path/script.sh").start();