I do not know what you are doing with p.getErrorStream (), you are not using it.
The way to determine the result, that is, the exit code of the command being executed, is to add the following lines after
p = run.exec(cmd);
p.waitFor();
System.out.println(p.exitValue());
And put p.destroy () in the finally block.
Hope this helps.
source
share