I have tried running a shell script from a Java program, but the entire script is not being executed. And idea why we might come across such problem?
The Java code to execute shell script:
File file = new File("/path/to/script");
String COMMAND= "./run";
ProcessBuilder p = new ProcessBuilder(COMMAND);
p.directory(file);
try {
Process startProcess= p.start();
} catch (IOException e) {
e.printStackTrace();
}
The script runs fine but not whole script is executed. It seems like only the 1st line is being executed.