GOBBLER: package org.jamescarr.payfuse.fit; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class StreamGobbler extends Thread { private InputStream is; private String type; public StreamGobbler(InputStream is, String type) { this.type = type; this.is = is; } public void run() { BufferedReader reader = new BufferedReader( new InputStreamReader(is)); try { System.out.println("Running " + this.type); String line = ""; while ((line = reader.readLine()) != null) System.out.println(type + ">" + line); } catch (IOException ioe) { ioe.printStackTrace(); } } } COMMANDLINE RUNNER: package org.jamescarr.payfuse.fit; import java.io.IOException; public class PayFuseTest { public static void main(String[] args) { PayFuseTest pf = new PayFuseTest(); try { pf.testInput(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void testInput() throws IOException, InterruptedException { String[] command = new String[3]; command[0] = "/bin/ls"; command[1] = "-al"; command[2] = "/home/jamescarr/"; Process proc = Runtime.getRuntime().exec(command ); // any errors? StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR"); // any output? StreamGobbler outputGobbler = new StreamGobbler(proc.getErrorStream(), "OUTPUT"); errorGobbler.start(); outputGobbler.start(); int exitCode = proc.waitFor(); System.out.println("exit code: " + exitCode); } }