DestroyJavaVM does not completely shut the VM

Hi All,

I'm using JDK 1.4.2. The platforms used are WindowsXP and MacOSX. In my Native Application after setting up the JVM using JNI_CreateJavaVM, i use the same to load some jar files using URLClassLoader. After all is done i need to shut the VM and then move these jar files to some location. I use DestroyJavaVM, but it does not seem to completely do its task. Some of the threads started by JNI_CreateJavaVM are still up and owing to this the jar files are held up by VM. Is anyone having any idea whether DestroyJavaVM is still faulty or do i need to do something else.

Regards

[603 byte] By [RajanKarola] at [2007-10-3 0:43:13]
# 1

Sorry but DestroyJavaVM isn't guaranteed in the current Java SE implementation to completely terminate everything. For example you can't currently destroy the VM and create a new one in the same process.

I would recommend you try to forcibly close the jar files you've opened before terminating the JVM. For example, you might drop all references to instances of classes defined by that URLClassLoader and perform a couple of full GCs to see if the URLClassLoader is collected and its jar files closed. Or you might subclass URLClassLoader and add a method to close down all of the jar files it has open.

kbrussela at 2007-7-14 17:37:38 > top of Java-index,Java HotSpot Virtual Machine,Specifications...