AnonymousClassLoader and ClassLoader
forax at univ-mlv.fr
Thu Apr 24 04:43:42 PDT 2008
Rémi Forax a écrit :
> Yesterday evening, I've tried to replace the application classloader
> (the one used to load the application) by one that use an anymous class
> to load the class. And i've tested by launching SwingSet2.
> And it doesn't work because UI program like SwingSet lookup their
> like image, icons etc. using getResource()/getResourceAsStream().
> getResource() makes the assumption that if getClassLoader() returns null
> the class is loaded by the bootstrap classloader.
> In my opinion, getResource() is not the only method that makes this
> so an anonymous class should be able to specify an external classloader
> when defined i.e. Unsafe.defineAnonymousClass should take
> a classloader as argument.
I answer to myself, it's only in the case the host-class is null,
otherwise the classloader used is the one of the host-class.
What is exactly the meaning of a null host-class ?
More information about the mlvm-dev