This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
custom class Loader
Posted by Soumya Dutta on April 14, 2001 at 7:17 AM
I would also like to the answer to your question. I already have my classfile encrypted in some form and after decrypting, I have got the byte array which has the byte codes of the class file, but i am not able to make a Class object out of it. Please help.
Thanks in advance,
> I have written a custom class loader in using java 2.
> In my custom class loader I override the findClass() method
> in order to load classes from a jarConnection. All this is
> working fine. My question is how can I get my custom class
> loader to be used whenever another class is to be loaded. I
> have used a small bootstrap class that creates my custom loader
> and loads/invokes a main class. From there the main class creates other objects but it seems to use the primoridial class loader.
> I have also had my main class create an instance of my custom class and load/instantiate a new class. Then the new class
> creates another class using the new operator. I would expect
> my custom class loader to be invoked but alas it seems that the
> primordial class loader is used yet again.
> I have read your column and book excerpt and can't figure out
> why my custom class loader isn't be used 'automatically' after
> I have used it to create parent classes. Could there be a scope
> problem ( could the instance of my classloader be going out of scope ) I can't see how but have no other ideas.
> The way I see it I should never get a ClassNotFoundException
> without the findClass code I wrote being executed first ( assuming I loaded the application/class with my loader )
> any ideas?