instead of
stderrprocessor.run(); //<-- the block occurs here!
stdoutprocessor.run();
You need to start threads:
Thread errThread = new Thread(stderrprocessor);
errThread.setDaemon( true );
errThread.start();
Thread outThread = new Thread(stdoutprocessor);
outThread.setDaemon( true );
outThread.start();
run()
is just a method specified in Runnable
. Thread.start()
calls run()
on the Runnable
in a new Thread
.