If I remember correctly, for JUMP it was quite slow to determine this
programatically (I think you have to instantiate every class in the jar). So
instead we search based on the _name_ of the class, i.e., *PlugIn.class.
 
You should be able to do the same in your case if all classes that implement
that interface are named in some computable way.
 
Jon
 
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Sunburned Surveyor
Sent: Wednesday, April 04, 2007 3:33 PM
To: List for discussion of JPP development and use.
Subject: [JPP-Devel] Help with a Java problem...


I'm hoping you guys might be able to help me out with a Java problem I'm
having.
 
I can't seem to find a way to determine if a JAR file contains a class that
implements a particular interface. I need to be able to do discover this
programmatically. If the JAR file does contain an implementation of the
interface, I need to be able to obtain the Class object for that
implementation. I've been reading online, but haven't quite found what I
need. I think JUMP does something similar when it loads plug-ins, but I
peeked in the source code for the PlugInManager class and the
WorkbenchPropertiesFile class and didn't find what I needed. 

I'm guessing it involves using the getEntry() method of the
java.util.jar.JarFile class. Is this correct?

After the Entry object is returned by getEntry(), how do I convert it to a
Class file?

Thanks, 
 
The Sunburned Surveyor

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to