How to read/capture/get the console output

August 26, 2010 at 02:35:51
Specs: Windows XP
For example, HelloWorld.java prints out "Hello World" to standard output (screen display) . How can I write another java program to capture the output "Hello World" after HelloWorld.java is executed? I just don't want to use a temp file to store the data.

Can somebody provide me couple lines of code as a hint?


Thanks a lot !!!


See More: How to read/capture/get the console output

Report •

#1
August 26, 2010 at 06:07:13
Depends on how you're running both programs. If your capture program doesn't spawn HelloWorld.java, just use System.in.

If it does spawn HelloWorld.java, just use the Processes getInputStream().


Report •
Related Solutions


Ask Question