1

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

1 Answer 1

2

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();
answered Jan 3, 2014 at 17:53
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.