Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

How to judge the commond called by Runtime executed successfully or not



I use java.lang.Runtime to call some standalone executeable commond (which will open another application do some operation use a comond line manner) in my application,however I can not judge whether the commond is executed or whether it is executed successfully. And someone tell me I should define the standard for judge the success and failture. But I have no idea.

In my opinion,take the "dir" for example(although it is a interpret commond), if the output is the contents of a directory, it is success,if it give other messages,it is false,so in this case ,how to express my meaning in the java codes?

I would like some can give me some advice or example.Thanks.