在下面的代码片段中,如果我仅使用
p.destroy()
销毁Process p
,则只有进程p
(即cmd.exe
)会被关闭。但是其子进程iperf.exe
没有被终止。如何在Java中终止此进程。Process p= Runtime.getRuntime().exec("cmd /c iperf -s > testresult.txt");
Runtime.exec()
,请使用ProcessBuilder
。 - fge