Process process = Runtime.getRuntime().exec("cmd /c start tester.exe");
process.waitFor();
這個代碼中的process.waitFor();并沒有起到作用
后面的代碼在調用的tester.exe還沒結束就繼續運行了,
結果發現是因為在exec里面用了start
這樣的后果是process.waitFor()等待的是一個一閃而過的用來打開exe的命令行窗口而已.
去掉start這個詞,就會等到exe結束程序在繼續執行了.
posted on 2011-04-07 21:34
ApolloDeng 閱讀(2798)
評論(1) 編輯 收藏 所屬分類:
筆記 、
Java