One caveat is that it is difficult to cancel the command thread early.
I have been meaning to work it out but I believe it is a known bug.
From: Raymond Hooker (rhooker)
Sent: Friday, September 09, 2005 12:08 PM
To: 'Research Triangle Java User's Group mailing list.'
Subject: RE: [Juglist] launching application in Windows without
Actually it is quite a bit more complex than that. I assume that you
want to run a command and receive the output. I do that for running
Python scripts and capturing the output. Also, I spawn another thread
so that my original menu is not locked up. The following code may give
you an idea. Note that it monitors the output (STD and ERR) and send a
progress message to a progress pane in Swing: