How to return an error code to DOS at the end of a java batch

Hi,

I have a batch file which launch my java program.

At the end of the program, I would like to give my batch file an error code.

Do you know how to do that?

Does the main function is able to return an error code?

Does the bat file is able to recover it?

Thanks in advance for your help!

Nicolas

[345 byte] By [toto@toto@toto] at [2007-9-30 20:27:31]
# 1
System.exit(int);see http://java.sun.com/j2se/1.4.1/docs/api/java/lang/System.html#exit(int)
phawdon at 2007-7-7 1:11:54 > top of Java-index,Java Essentials,Java Programming...
# 2
I am OK for the system.exit, but how about recoreving the error code in DOS?I have:java -cp "%CLASSPATH%" tets.BatchRetourDo I have to simply put:set CodeRetour = java -cp "%CLASSPATH%" tets.BatchRetour?
toto@toto@toto at 2007-7-7 1:11:54 > top of Java-index,Java Essentials,Java Programming...
# 3
Hi,No, the variable ERRORLEVEL will hold the status code of the "command" last executed. E.g.java -cp "%CLASSPATH%" tets.BatchRetourIF ERRORLEVEL 1 goto HandleErrorFor more info see http://home.att.net/~gobruen/progs/dos_batch/dos_batch.html/Kaj
kajbj at 2007-7-7 1:11:54 > top of Java-index,Java Essentials,Java Programming...