user234194
user234194

Reputation: 1723

exec command in java

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.

Upvotes: 1

Views: 531

Answers (2)

KLee1
KLee1

Reputation: 6178

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.

Upvotes: 4

bwawok
bwawok

Reputation: 15377

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

Upvotes: 2

Related Questions