List of usage examples for org.apache.commons.exec DefaultExecutor DefaultExecutor
public DefaultExecutor()
From source file:wf.frk.tilde.sblauncher.SauerbratenExecutor.java
public void startThread(String executable, String[] params, String working_dir) throws ExecuteException, IOException { setDaemon(true);//from ww w. j ava 2 s .c o m startThread(); CommandLine cmdLine = CommandLine.parse(executable); for (String p : params) { System.out.println(p); cmdLine.addArgument(p); } DefaultExecutor executor = new DefaultExecutor(); PipedOutputStream output = new PipedOutputStream(); PumpStreamHandler streamHandler = new PumpStreamHandler(output, System.err); SAUER_OUTPUT = new Scanner(new PipedInputStream(output)); executor.setStreamHandler(streamHandler); executor.setWorkingDirectory(new File(working_dir)); executor.execute(cmdLine); }