System.exit()
Exit code is 0 when execution went fine; 1 , -1 , whatever != 0 when some error occurred, you can use different values for different kind of errors. If I'm correct exit codes used to be just positive numbers (I mean in UNIX) and according to range: 1-127 are user defined codes (so generated by calling exit(n) ) 128-255 are codes generated by termination due to different unix signals like SIGSEGV or SIGTERM The following codes are from http://www.opensource.apple.com/source/Libc/Libc-320/include/sysexits.h. Note Ref: http://stackoverflow.com/questions/2434592/difference-in-system-exit0-system-exit-1-system-exit1-in-java sysexits.h [ plain text ] /* * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source