posted 11 years ago
I had this problem when I was starting threads that ran in background. When I shut down the main application those threads kept the JVM running. I could only kill it from the OS. The trick was to set them to be daemon threads. Look at the definition of daemon in the Thread API doc. The language is awkward, but it says any threads that are not daemon will keep the JVM running, but threads that are daemon will not keep the JVM from killing them and shutting down. Let me know if that helps!