|
|
@ -9,17 +9,26 @@ public class AProcess {
|
|
|
|
|
|
|
|
|
|
|
|
// args is the command
|
|
|
|
// args is the command
|
|
|
|
ProcessBuilder pb = new ProcessBuilder(args);
|
|
|
|
ProcessBuilder pb = new ProcessBuilder(args);
|
|
|
|
Process process = pb.start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// obtain the input and output streams
|
|
|
|
try {
|
|
|
|
InputStream is = process.getInputStream();
|
|
|
|
Process process = pb.start();
|
|
|
|
InputStreamReader isr = new InputStreamReader(is);
|
|
|
|
|
|
|
|
BufferedReader br = new BufferedReader(isr);
|
|
|
|
// obtain the input and output streams
|
|
|
|
|
|
|
|
InputStream is = process.getInputStream();
|
|
|
|
|
|
|
|
InputStreamReader isr = new InputStreamReader(is);
|
|
|
|
|
|
|
|
BufferedReader br = new BufferedReader(isr);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String line;
|
|
|
|
|
|
|
|
while ( (line = br.readLine()) != null)
|
|
|
|
|
|
|
|
System.out.println(line);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
br.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
System.out.println(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String line;
|
|
|
|
|
|
|
|
while ( (line = br.readLine()) != null)
|
|
|
|
|
|
|
|
System.out.println(line);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
br.close();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|