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();

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();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.