java打开后台程序

try{

String cmds="java -version";

Process p = Runtime.getRuntime().exec(cmds);

int exitValue = 1;

if((exitValue = p.waitFor()) != 0)

{
p.destroy();

System.out.println("exitValue:"+exitValue);

System.exit(exitValue);
}

}catch (IOException e) {

e.printStackTrace();

}catch (InterruptedException e) {

e.printStackTrace();

}

posted on 2017-08-03 15:47  blfbuaa  阅读(179)  评论(0编辑  收藏  举报