How can I use Java to get the output from another application started from the comandline?

Abstract: How can I use Java to get the output from another application started from the comandline?

Question:

Using Java, how can I obtain the text output messages from executables?

Answer:

You can obtain the output in the folloing way:

Process p = Runtime.getRuntime().exec("App.exe");

InputStream is = p.getInputStream();

BufferedReader br = new BufferedReader(new InputStreamReader(is));

...