您将需要将Process输出,err和输入流复制到System版本。最简单的方法是使用Commons
IO包中的IOUtils类。该复制方法看起来是你需要的。复制方法调用将需要在单独的线程中。
这是基本代码:
// Assume you already have a processBuilder all configured and ready to gofinal Process process = processBuilder.start();new Thread(new Runnable() {public void run() { IOUtils.copy(process.getOutputStream(), System.out);} } ).start();new Thread(new Runnable() {public void run() { IOUtils.copy(process.getErrorStream(), System.err);} } ).start();new Thread(new Runnable() {public void run() { IOUtils.copy(System.in, process.getInputStream());} } ).start();


