If you call your
Java program from a shell script (in Unix) or a batch file (in Windows), you can check the return value, which is the value you pass to System.exit(...), in the script or batch file.
Most Unix and Windows programs that return a value like this, return 0 when there's no error and something else when there is some kind of error.
What value
you should return depends on what you want to do in the script or batch file under certain conditions.