/** *//** * 子进程 */public class RuntimeTest ...{ public static void main(String[] args) ...{ Runtime r = Runtime.getRuntime(); Process p = null; try ...{ p = r.exec("notepad.exe"); //Thread.sleep(10000); // 1 p.waitFor(); // 2 } catch (Exception e) ...{ e.printStackTrace(); } p.destroy(); }} 注释1后 主进程等待子进程结束后结束. 注释2后 子进程运行10秒后结束.