Originally posted by Rob Ross:
You have to create a custom class loader, and early in your loading process, use your class loader to load the classes you might wish to later unload. When you dispose of the class loader, all the classes loaded by it are also disposed. Then you can create a new class loader and reload those classes, thus getting the effect of dynamic loading.
Ok i have a doubt. Say i have a custom classloader which loads the first version of a class. As usual i assign the loaded class instance to an interface handle.
Then i try loading the changed version of the class through another Custom Class loader instance.
Now even if i explicitly set the earlier class loader to null, will the first version of the class really unload? since i'm holding to an instance of that class?
My guess is that in that case 2 versions of the class will reside in the JVM.
can anyone confirm this?
thanks!