How to call an external script/prgm and wait until execution is finished?

S

Sven Fischer

I want to call from inside a java program an external script (resp. prgm) and wait
until the execution is finished (successfuly or not).

How can I do this?

For simplicity assume the external script is either an DOS batch scipt (Windows) or shell script (Linux).

How can I ask from inside the Java program for the return/exit code?

Sven
 
A

Arne Vajhøj

I want to call from inside a java program an external script (resp. prgm) and wait
until the execution is finished (successfuly or not).

How can I do this?

For simplicity assume the external script is either an DOS batch scipt (Windows) or shell script (Linux).

How can I ask from inside the Java program for the return/exit code?

http://docs.oracle.com/javase/6/docs/api/java/lang/Process.html#waitFor()

http://docs.oracle.com/javase/6/docs/api/java/lang/Process.html#exitValue()

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top