【发布时间】:2017-06-01 19:23:19
【问题描述】:
此代码导致带有 if 语句的行出现 IllegalThreadStateException 运行时错误:
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");
}
这个应该运行的可执行文件有退出代码 1。我做错了什么,我该如何解决?
【问题讨论】:
-
你想
"\"c:\\[directory]\\doer.exe\""吗?
标签: java process processbuilder exit-code