/** * Makes the TProcess print out and error streams into one specified file. Several files can be * registered. * * @param logFile The file to print. * @throws FileNotFoundException */ public void registerOutput(File logFile, String prompt) throws FileNotFoundException { // Links to standard and error outputs if (errorStream == null || outputStream == null) { errorStream = new StreamListener(process.getErrorStream()); outputStream = new StreamListener(process.getInputStream()); errorStream.start(); outputStream.start(); } // Links to output file if (logFile != null) { FileOutputStream fileOut = null; fileOut = new FileOutputStream(logFile); errorStream.registerOutputStream(prompt, fileOut); outputStream.registerOutputStream(prompt, fileOut); } }