If you launch a program using Runtime.exec(), you get back a Process object. You can use getErrorStream() and getOutputStream() on the Process object to extract the output.
There are problems, though. You have to ensure that the program you launch doesn't ever stop and ask for input, even on error conditions. I also had problems when I used a buffer on the output and it would block until sufficient characters came in - it seems to me I ended up making the buffer just a few characters long... "When you have eliminated the impossible, whatever remains, however
improbable, must be the truth." ~ Arthur Conan Doyle