I am using a thread to capture stream output from a process, and then outputting that stream to the eclipse console. The question I have is when to terminate the thread that
You need to use Process.waitFor() to wait for process completion.
Additionally, you need to consume stdout and stderr concurrently in order to avoid blocking and a possible process hang. Consequently you need two threads to read these streams, and to continue reading whilst the streams are available.
See this Javaworld article for more info and a StreamGobbler
implementation to consume the stdout/err.