I loaded my jar classes with:
ClassLoader.getSystemClassLoader().loadClass(name)
in my Plugin loader. But it seems JVM does not register them as a class as if they were referenced, therefore they get garbage collected I get:
ClassNotFoundException at runtime
How can I register them as if they were a referenced library? Also, how does JVM load referenced library classes and keeps them registered during JVM lifetime? Can we register runtime loaded classes that way?
Example:
I have an abstract class called AbstractAction in my main project. Then a jar calls x.jar implemented it in ActionImpl. I loaded the jar at runtime and used ActionImpl. But classes that are used in ActionImpl like Utils are not loaded and I get ClassNotFoundException on Utils.