Runtime.exec() with get command output

hi,

How can i get output of command which i run with runtime.exec().

p.e.:

Process p;

Runtime r = Runtime.getRuntime();

p = r.exec("net use \\pc\dir pswd /user:username");

if command was done succesfully that in cmd is return this:

"The command completed successfully." I can get this text, but i dont know how.

Plese help

thank you

Palo

[407 byte] By [gibickoa] at [2007-10-3 0:54:28]
# 1
Hi, you should retreive the streams from the Process and read from them. (Read the javadoc for Process)Kaj
kajbja at 2007-7-14 17:49:48 > top of Java-index,Java Essentials,Java Programming...
# 2
Look at the API for [url= http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Process.html#getInputStream()]Process[/url]
mlka at 2007-7-14 17:49:48 > top of Java-index,Java Essentials,Java Programming...
# 3
And the standard reply (in case you did not see this): http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
jbisha at 2007-7-14 17:49:48 > top of Java-index,Java Essentials,Java Programming...