Hi, I have three programs, A.java, B.java and C.java I want to run them sequentially using .bat file,such that only when A.java does not throw an exception, I should execute B.java else I should execute C.java Could any one tell me how to write a DOS batch file for this. Thanks
Joined: Nov 22, 2008
Hi, why don't you write a single main class, which starts your A.java B.java C.java if no exception is thrown ??? As far as i know there is no exit status in java like in C for example. So the solution above should be easy and effective.
Joined: Oct 19, 2000
Oliver is right about executing all of the logic from java as a better solution. However, there ARE exit codes in java. If the exit code is not zero, that means the program failed to execute. The variable errorLevel should contain the exit code in the batch script.