Class Loader

Is is possible to use the ClassLoader in order to explicity load/unload classes? This is not for an applet but for an application.
[144 byte] By [gmisk] at [2007-9-26 7:49:09]
# 1
Yes, but you have to remember that a classloader maintain references to all classes that's been loaded through it. To reload a class you therefore need to get rid of all references to its classloader as well as all references to all objects of the class itself.- Marcus
msundman at 2007-7-1 17:59:37 > top of Java-index,Core,Core APIs...
# 2

>...ClassLoader in order to explicity load/unload classes?

No. There is no way to make java unload classes.

Classes are unloaded when the class loader is garbage collected. That can occur when there are no more instances to any of the classes that the class loader controls (keeping in mind that the system class loader is never unloaded.)

Since there is no way to make java garbage collect the class loader, then by definition there is no way to unload a class.

However, by using a new class loader one can keep loading new classes which can be used to 'replace' the previous loaded versions.

jschell at 2007-7-1 17:59:37 > top of Java-index,Core,Core APIs...