How to get error message when execution binary file with Runtime?
My code is:
Runtime localRuntime = Runtime.getRuntime();
String strExec = "myBinary -s -a myconfigbinary.conf";
try {
localRuntime.exec(strExec);
System.out.println("Success execute.");
} catch (IOException e) {
System.out.println(e.getMessage().toString());
}
My code is above, I only get the exception error when the file does not exist. but if I run using the console on the computer when it did not work because of the error in the configuration file or whatever is causing the binary is not running, but I still get message Success execute..
My question is i want to get error message like when i get an error on the console on the computer. How to use the correct exception in this case?
Thanks.