>>Either consume the contents of the output and error streams
> How do I do this?
Runtime.exec() returns a Process object. Obtain the output and error
streams from that.
Read each of those streams until you reach EOF. Note that you need to
read both streams concurrently, so you will need an additional thread
for one of them.
If you *know* that the process will not write anything to its error
stream, you can cheat a little, and not read from that stream. That
also removes the need for the additional thread.
Finally, after reaching EOF on the streams, wait for the process to
terminate and get the exit value.
A simpler (but platform specific) solution is to let a shell do the
work for you. Specify the command line as an array of 3 Strings, like
this:
String[] cmd = {
"/bin/sh",
"-c",
"iosconvert /home/arvind/cisco2.conf /home/arvind/nct1/bin/cisco2.xml"
+ " > /dev/null 2>&1"
}
It's important to group the command into 3 Strings exactly the way
I've shown here (I broke the last one only to avoid line wrapping in
my post).
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
John Currier - 17 Jun 2005 19:41 GMT
Didn't they implement something in 1.5 so you don't have to go though
that mess?
John