Reputation: 1
I'm trying to read exit value from external program but it's always 0.
String command = ("cmd /c start /wait "+ Script[0]);
Process exec = runtime.exec(command);
int waitFor = exec.waitFor();
System.out.println(exec.exitValue); //always 0
System.out.println(waitFor); //always 0
Program is used for programming modules and I need to know if there were any error's.
How to get the application exit value?
Upvotes: 0
Views: 485
Reputation: 2476
The program you're actually running is the cmd
program, not whatever you're running under that.
See How do I get the application exit code from a Windows command line? for how to extract the underlying exit code.
Upvotes: 1