How to increase performance when using ProcessBuilder to execute external command in Java
<p>I use <code>ProcessBuilder</code> class to execute external commands in Java.</p>

<p>The code likes below.</p>

<pre><code>ProcessBuilder pb = new ProcessBuilder(command);
pb.redirectErrorStream(true); 
Process process = pb.start(); 
...
// instance a new thread to read process output
...
process.waitFor(); 
...
</code></pre>

<p>But If a lot of commands are used to executed by this approach.
As <code>waitFor()</code> would cost plenty time, and command executing time would cost more then Linux command line.</p>

<p>Is there any approach to increase the <code>waitfor()</code> performance, or other efficient approach to executing command in java?</p>