While looking at somebody's maven Java project in eclipse, I noticed that one of saved run configurations has following maven command to run:
test -Dtest=fooTest -Dcom.awesomesite=System.out
public final static String BAR = "com.awesomesite";
this.whereToWrite = System.getProperty(BAR);
When you launch a run configuration Eclipse starts a new process to run it using
Runtime.getRuntime().exec(...). This returns a
Process object representing the new process.
Process has a
getInputStream() method which returns an
InputStream connected to the standard output of the process (which is where
System.out normally writes). Eclipse reads from this input stream and outputs what it receives on the console.
Eclipse also reads from the process error stream using