As we've said, you use System.exit(int) to exit a java program with some "exit status code". Also note that if your program exits because the main
thread throws an exception, the VM will exit with a non-zero status. A zero exit status usually means "OK", and non-zero means "BAD".
But how you use this value depends on the environment you are running in.
In Unix, you can get the exit status of the most recent command using the shell variable $?.
If you run the program from Java with Runtime.exec(), then you can find the exit status form Process.exitValue().
I have no idea how you do this if you invoke a program from VB or DOS or etc....