[Advanced-java] Class Loader Question
Mike Curtis
mike at mullsoft.co.uk
Sat Nov 26 03:26:32 PST 2005
I think I must be misunderstanding something about the way the class
loader works.
I have a (large) Java program that includes its own class loader,
essentially to handle an unknown number of plugins, that just looks for
jar files in a specific directory and reads their contents all in during
initialization. This works fine for all my own code, and some external
code but I have just started having a problem with an external jar that
keeps coming up with Class not found errors; it is actually jmf.jar if
that makes a difference the first time I call a Player. My class loader
is definitely finding and reading the file. If I put in a
Class.forName() specifying my own loader a few lines before the failing
call then this works OK and finds the Class, but it still then says
Class not found when I call anything and the stack trace shows that it
is only looking in the system loader.
The program is run from a script (or on windows a small launcher) that
just calls javaw specifying on the command line the classpath as just
the one main system jar of my program and the main class that runs in
that, which instantiates my class loader as the first thing it does.
Can anyone tell me how to force loading of these classes through my own
loader which I know works OK on that jar because the Class.forName() works.
Thanks
regards
Mike
--
MullSoft Ltd.
Catalog software to organize everything on your computer
http://www.mullsoft.co.uk/jean
More information about the Advanced-java
mailing list