Rob Prime wrote:Class a = Class.forName("Abc"); will use the system class loader. This class loader does not know anything about your MyClassLoader instance or the classes it has loaded. (Your MyClassLoader instance does know about the system class loader though, since that's its "parent".)
The system class loader will try to load class "Abc" using its own mechanism. It can't find it, so it throws an exception.
Your MyClassLoader instance is doing its work just fine, as both Class c and the object created by it are printed out without any problems.
So is there any way in
java , where if that class is loaded by any(Custom) classloader then, system classloader will not try to load it again.