tags:

views:

45

answers:

2

If i am using following command in java:

Process ps = Runtime.getRuntime().exec("some .exe file of VB");

How do I know that the particular .exe has done its job eg: it executed successfully.

How do i know that it has some error or just completed half task in java. How should I design my program in java to know or Is there any way to tell java from VB.

Any help is appreciated.

+4  A: 

I would assume that you could look at the exit status of the program: ps.exitValue() or you could read the stdout/stderr ps.getInputStream() / ps.getErrorStream() respectively.

KLee1
+1, Though you MUST read the stdout/stderr; whether you pay attention to it after reading it is up to you :-).
Mark Peters
@Mark True, that's a whole other series of SO questions. Thanks for the edit, I didn't read the API close enough.
KLee1
+2  A: 

You get back a Process

http://download.oracle.com/docs/cd/E17476_01/javase/1.4.2/docs/api/java/lang/Process.html

Which has such methods as:

exitValue() 
getErrorStream() 
waitFor()

Which will get you what you need

bwawok