136137138139140141142143144145146
// start output threads t1.setDaemon(true); t2.setDaemon(true); t1.start(); t2.start(); // wait for the process (application) to finish executing int returnValue = process.waitFor(); // make sure other two threads are done