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:exampleexample.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:exampleexample.exe argument1 argument2" can be run successfully by hand via cmd.exe, so we are confident the command itself is not broken.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…