views:

14

answers:

1

I create new process from a java code using ProcessBuilder

ProcessBuilder builder = new ProcessBuilder("/path/to/bin");
Process process = builder.start();

In this case, I am not interested in seeing error/output. Is it necessary to grab OutputStream and ErrorStream? Is it automatically ignored?

Output may be large (10MB) -- in some cases.

+3  A: 

You're not required to do anything with those streams, but you should be aware that the created process may block if the output buffers become full. If you know that the process you are creating does not produce much (or any) output to stdout or stderr then you're probably OK, otherwise you should create threads that read and discard the output from each stream.

Cameron Skinner