java 重启进程

try {
//关闭进程
String command = "taskkill /f /im xx.exe"; 
Runtime.getRuntime().exec(command);
Thread.currentThread().sleep(2000);
//启动进程

String path = "E:\\xx\\xx\\xx.exe";
System.out.println(path);
Runtime.getRuntime().exec(path);

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

猜你喜欢

转载自lanxulin.iteye.com/blog/2210694