What is the purpose of waitFor.

java.lang.Runtime rt=java.lang.Runtime.getRuntime(); pr= rt.exec(par);pr.waitFor();Can u explain this in detail
[139 byte] By [dsefds2s2a] at [2007-11-26 17:37:40]
# 1
You are waiting for the process you started to exit. And getting the exit code returned by the process.~Tim
SomeoneElsea at 2007-7-9 0:05:50 > top of Java-index,Java Essentials,Java Programming...
# 2

From the javadoc:

causes the current thread to wait, if necessary, until the process represented by this Process object has terminated. This method returns immediately if the subprocess has already terminated. If the subprocess has not yet terminated, the calling thread will be blocked until the subprocess exits.

So it maeks your thread block / wait until the process/program you opened ends.

Javadoc is your friend.

Hth

Lima

LimaBravoa at 2007-7-9 0:05:50 > top of Java-index,Java Essentials,Java Programming...
# 3
@Op. Note that waitFor won't terminate if the proccess is writing to stderr or stdout and you aren't reading from those streams.Kaj
kajbja at 2007-7-9 0:05:50 > top of Java-index,Java Essentials,Java Programming...