My ultimate goal is to reload classes after they are already loaded into the JVM.
Having read the following answer Unloading classes in java? , I'm trying to implement my own Class-Loader, which itself creates another instance of the Loader class (of the same type) for each class that it loads.
therefore, the result is one class per loader class.
The goal is to be able to have a GC class, that is, all its instances, and then unload its classloader and be able to reload the same class from its bytes.
The problem is this: I can see that my class instance is garbage collection using the finalize () method, but I cannot load my class loader or collect garbage. is there any code example, a simple test that shows how this can be done?
thanks, any help would be appreciated
Edit
to be more clear, I'm interested in code examples in which the creation of new objects occurs via the operand 'new ()', and the class loader does not explicitly reload the class basically, but after calling the next "new ()".
eran levi
source share