I’ve implemented an example from Apaches’s web: http://commons.apache.org/exec/tutorial.html
What I need now is listen / receive feedback from a heavy process.
I know how to print the process result using setStreamHandler method but this result is displayed once the execution finished.
I suggest you read
PumpStreamHandlerandInputStreamPumper. You basically want almost exactly these classes. Just modify theInputStreamPumper.run()loop. Instead ofos.write(), it should fire your event. To allow the results to start arriving while your process is running, call it as follows: