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();
}