Why do I have to call System.exit() from my main method?
There are many cases where a Java program will quit on its own when main() exits, but there are also many sneaky cases where a thread is launched without your knowledge by a library routine. Database Connection Pools are notorious for doing this.
A warning: Make sure you only call System.exit() when you're really really sure all background threads have stopped processing. Otherwise the threads will be stopped prematurely, and may leave things in a bad state (for instance, if they're halfway through writing a file).