Alex S
Posts: 27
Nickname: andu
Registered: Mar, 2003
|
|
Re: Custom ClassLoader & getClassLoader
|
Posted: Aug 21, 2003 1:21 AM
|
|
Create a custom class loader (public class MyClassLoader extends ClassLoader). Then do: myClassLoader.loadClass("ClassToLoad") Your class loader should read the bytecode and then call defineClass() (from the ClassLoader class). From now on, any class referenced by class ClassToLoad will come to your class loader to load. But if you delegate the loading to your parent class loader (let's say for JFrame), then don't expect to catch the loading calls for the classes refered by JFrame.
The idea is that if a class C is loaded by a class loader L, then the JVM will ask L to load any class referenced by C. Of course, L could delegate the loading to its parent class loader. So, be careful when writing your custom class loader.
|
|