Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Override and extend default ClassLoader

843810Feb 15 2004 — edited Feb 15 2004
Hi,

I've been messing around with the ClassLoader for a long time now (maybe 8 hours) and i just dont get it.

What it try ist to do the following:

Store the class Test.class in a package. (somewhere) The class Test can have many versions (plugin-system).

A developer should be able to code like this without bothering which version the Test.class has.

Test t = new Test();

Now the problem comes:

I want MY ClassLoader to load the Test.class defined in a XML with the newest version. Or (maybe) an other version defined by an XML file. Again the programmer should not have to work with reflect to use the Test.class.

I've written my own ArchiveLoader class which extends the ClassLoader and used the -Djava.system.class.loader=ArchiveLoader setting. But: My ArchiveLoader.loadClass()-Method is only called to load the Main Class and i just dont get why. Any other class is loaded by the AppClassLoader.

If ANYONE could just post an complete example how to tell java to look at mine loader first.... I'd build a skyscraper with a swimmingpool with my own hands for him...

thnx a lot.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 14 2004
Added on Feb 15 2004
1 comment
240 views