I'm using the process builder to launch new main classes. I do builder.inheritIO(); and it works in Eclipse (stdout and stderr redirect to the single console). However, when I export a jar, the the output doesn't redirect (only original process output showing). I'm on Java 7. Any ideas where I should look at?
Some code:
ProcessBuilder builder = new ProcessBuilder(arr);
//builder.redirectOutput();
//builder.redirectError();
//builder.redirectOutput(ProcessBuilder.Redirect.INHERIT);
// those don't work either
builder.inheritIO();
Process p = builder.start();
asked Feb 8, 2013 at 5:12
Raekye
5,1318 gold badges53 silver badges75 bronze badges
1 Answer 1
It seems to be a bug in java under windows. Will be fixed in java8.
https://bugs.openjdk.java.net/browse/JDK-8023130 .
You can use the old way and redirect the streams manual.
ProcessBuilder builder = new ProcessBuilder("...");
Process p = builder.start();
p.getOutputStream();
p.getInputStream();
p.getInputStream();
Sign up to request clarification or add additional context in comments.
Comments
lang-java