| Author |
interogating jars for specific classes
|
Wendy Gibbons
Bartender
Joined: Oct 21, 2008
Posts: 1098
|
|
i am trying to write a method that goes around my classpath finding jars (that bit done and sorted using a url classloader).
then i want to interogate the jars hunting for any look and feels (so any class extending LookAndFeel)
here is my current attempt:
what am i supposed to do next?
i hope i have given enough information
edit:
Forgot to add this code has been copied from somewhere else in the application, but that insited the class name it was hunting for finished with CustomerAddOn, so i can't nick the rest of it. I considered reflection but that sounded far too heavyweight.
|
 |
Steve Luke
Bartender
Joined: Jan 28, 2003
Posts: 3026
|
|
|
It appears that the class you are trying to load is not present in the ClassLoader represented by 'currentClassLoader'. If the currentClassLoader is an instance of URLClassLoader you should first add the URL to the JAR before trying to load the class. Alternatively, if you already added the JAR to a ClassLoader, user that one to load the class file.
|
Steve
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
Also, don't forget that any libraries needed by those classes need to be loaded by that class loader as well. So make sure that either the URLClassLoader has loaded them, or they are loaded by a class loader which you then use to construct the URLClassLoader.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Wendy Gibbons
Bartender
Joined: Oct 21, 2008
Posts: 1098
|
|
well i have solved my own problem with:
but now i am 1 worried about rob's comment and 2 getting: java.lang.OutOfMemoryError: PermGen space.
I have decided to only load look and feels that end with LookAndFeel thus stopping me loading 12723 classes before running out of permgen memory
|
 |
 |
|
|
subject: interogating jars for specific classes
|
|
|