}
换成
try { if (process != null) { // use exitValue() to determine if process is still running. process.exitValue(); } } catch (IllegalThreadStateException e) { // process is still running, kill it. process.destroy(); } exitValue()函数采用非阻塞的方式返回,如果没有立即拿到返回值,则抛出异常。