Process pr = Runtime.getRuntime().exec(finalCommand);
BufferedReader br_in = null;
try {
br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String buff = null;
while ( (buff = br_in.readLine()) != null) {
System.out.println("stdout: " + buff);
try {
Thread.sleep(100);
}
catch (Exception e) {}
}
br_in.close();
}
catch (IOException ioe) {
System.out.println("Error printing process output.");
ioe.printStackTrace();
}
finally {
try {
br_in.close();
}
catch (Exception ex) {}
}
BufferedReader br_in = null;
try {
br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String buff = null;
while ( (buff = br_in.readLine()) != null) {
System.out.println("stdout: " + buff);
try {
Thread.sleep(100);
}
catch (Exception e) {}
}
br_in.close();
}
catch (IOException ioe) {
System.out.println("Error printing process output.");
ioe.printStackTrace();
}
finally {
try {
br_in.close();
}
catch (Exception ex) {}
}