Possible Duplicate:
Java external program
I am trying to wrtie a program to write a command on a command line,
for example;
ipconfig
and then get the response of the command so I want to both write command to a command line and get its response. I have searched about it on the net and saw that apache cli is used to do this in Java but actually I did not clearly get how it can be done. Can you please help me about my situation with a few line of codes or tutorials about both writing and reading commands please?
Thank you all very much
You could start it as a
Processand capture theInputStreamof the process as described here:Edit: I copied this code from above link, but the code seems wrong. Don’t you need the output stream for this? Edit2: no.
Nice naming convention…