try {
ProcessBuilder pb = new ProcessBuilder("D:\\Java\\jdk1.7.0_79\\bin\\java.exe","-version");
Process ps = pb.start();
InputStream is = ps.getErrorStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = br.readLine()) != null) {
System.err.println(line);
}
InputStream is1 = ps.getInputStream();
BufferedReader br1 = new BufferedReader(new InputStreamReader(is1));
String line1;
while ((line1 = br1.readLine()) != null) {
System.out.println(line1);
}
int exitCode = ps.waitFor();
System.out.println(exitCode);
} catch (Exception e) {
e.printStackTrace();
}
ProcessBuilder pb = new ProcessBuilder("D:\\Java\\jdk1.7.0_79\\bin\\java.exe","-version");
Process ps = pb.start();
InputStream is = ps.getErrorStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = br.readLine()) != null) {
System.err.println(line);
}
InputStream is1 = ps.getInputStream();
BufferedReader br1 = new BufferedReader(new InputStreamReader(is1));
String line1;
while ((line1 = br1.readLine()) != null) {
System.out.println(line1);
}
int exitCode = ps.waitFor();
System.out.println(exitCode);
} catch (Exception e) {
e.printStackTrace();
}