此代码导致 IllegalThreadStateException 运行时错误来自 if 语句:
public static void main(String args[]) throws IOException, InterruptedException {
Runtime runtime = Runtime.getRuntime();
Process proc = new ProcessBuilder("\"c:\\[directory]/doer.exe\"").start();
if(proc.exitValue() == 1)
System.out.println("Output: 1");
}
Run Code Online (Sandbox Code Playgroud)
应该专门运行的可执行文件具有退出代码 1。我做错了什么,我该如何解决?