其实就两句代码:

Runtime runt = Runtime.getRuntime();

runt .exec("cmd.exe /C start wmic process where name='cmd.exe' call terminate");