What kind of problem(s) could cause Java's ProcessBuilder.start method to return an IOException with a note saying error=5?
Specifically, we've seen a remote customer system running some Java code along the lines of...
ProcessBuilder pb = new ProcessBuilder(cmdArray);
pb.redirectErrorStream(true);
Process p = pb.start();
...throw exceptions like this...
java.io.IOException: CreateProcess: C:\example\example.exe argument1 argument2 error=5
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at example_code_above
We have confirmed that the command noted in the exception, "C:\example\example.exe argument1 argument2" can be run successfully by hand via cmd.exe, so we are confident the command itself is not broken.
error=5
means one of:
1) file is not executable
2) file is not accessible
EDIT: wont throw exception3) the command (example.exe) exits with exit code 5
Alexandr is correct, it's Windows security that's not allowing that process to run, but that powershell command didn't work for me. here's what I did:
Now your user can execute that program. Yay!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With