I am trying to load one class using custom logic (i.e. I want to change the class implementation in my libraries using a special version).
I would like to create my own custom classloader, which is a proxy to the default bootloader. However, it looks like my default class loader: sun.misc.Launcher.AppClassLoader is not displayed - this means that I can not extend it.
Any solutions for creating a single class loader that are strong enough to replicate the behavior of my existing class loader when matched in one particular class will be highly appreciated.
Please note that I tried using
Thread current = Thread.currentThread(); current.setContextClassLoader(newOne);
However, this does not work, that is, classes loaded into the stream do not always start my custom classloader.
CONTEXT
I want the calls to "new LibraryClass ()" to use the custom implementation of this class - where the call to "new ..." is in the jar file, which is not under my control.
source share