Printing Runtime exec() OutputStream to console

I recently ran into this problem and just wanted to mention that since java 7 the process builder api has been expanded. This problem can now be solved with:

ProcessBuilder pb = new ProcessBuilder("yourcommand");
pb.redirectOutput(Redirect.INHERIT);
pb.redirectError(Redirect.INHERIT);
Process p = pb.start();

Leave a Comment