I run the program like this:
Process process;
try {
process = new ProcessBuilder("java", "-jar", "test.jar", "1", "20").start();
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
The program I call uses standard output System.out.println("Hello!");
However, the the calling program gets nothing back. Am I using ProcessBuilder() wrong? Thanks!