dcsimg
Runtime.exec().............
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   srinivas_reddy
Posted On:   Friday, June 1, 2001 09:19 AM

hi,
i am invoking another application from my Java application like..
Runtime rt = Runtime.getRuntime();
Process pc = rt.exec(xxx.exe);
its working fine....
how to find out whether the specified application is running or not ?
is there any method to check whther our application(xxx.exe) is completed or
not ??

thanx in advance

sri

Re: Runtime.exec().............

Posted By:   AlessandroA_Garbagnati  
Posted On:   Friday, June 1, 2001 12:46 PM

Hi,

fhe javadoc for java.lang.Process states:

waitFor

    public abstract int waitFor() throws InterruptedException


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.

Returns: the exit value of the process. By convention, 0 indicates normal termination.

Throws: InterruptedException if the current thread is interrupted by another thread while it is waiting, then the wait is ended and an InterruptedException is thrown.

I think that this answer your question.
About | Sitemap | Contact