Capturing output from a process
Posted on 2001-06-06
I'm currently trying to capture the output of a given command so I can run some cross-checking with the results (the output). Here's what I'm using now, and it doesn't work.
Process p = Runtime.getRuntime().exec("java -version");
java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(p.getInputStream()));
String line = null;
for(line = br.readLine();line!=null;)
line = br.readLine();
This is not working. So does anybody know why?