/**
* 子进程
*/
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();
}
}注释2后 子进程运行10秒后结束.

705

被折叠的 条评论
为什么被折叠?



