Shutting down your Java program

To ensure that your program shuts down properly, issue System.exit(0) as the last instruction before your Java™ program ends.

Note: Avoid using System.exit(0) with servlets because doing so shuts down the entire Java virtual machine.

IBM® Toolbox for Java connects to the server with user threads. Because of this, a failure to issue System.exit(0) may keep your Java program from properly shutting down.

Using System.exit(0) is not a requirement, but a precaution. There are times that you must use this command to exit a Java program and it is not problematic to use System.exit(0) when it is not necessary.