Given a class, org.eclipse.ui.views.navigator.ResourceNavigator for example, how do I find out which jar file to use? I know it's in org.eclipse.ui.ide, but how would I find that out?
Edit: Thank you to all of you who answered. Like many things, there seems to be several ways to skin this cat. I wish javadoc contained this info. So far here are the different methods:
Without Internet, Eclipse or NetBeans:
for f in `find . -name '*.jar'`; do echo $f && jar tvf $f | grep -i $1; done
If you want to find out locally using Eclipse:
If you want to find out from Internet or you do not have the jar yet:
To find the . jar files that contain a class, you can use the FindClass.sh script. First go to a UNIX installation of Sterling Platform/MCF. If the FindClass.sh script already exists it should be in your $YFS_HOME directory or your $YFS_HOME/lib directory.
Download a hex editor and open one of the class files inside the JAR and look at byte offsets 4 through 7. The version information is built in. Note: As mentioned in the comment below, those bytes tell you what version the class has been compiled FOR, not what version compiled it.
A pragmatic way: Class. forName("com. myclass") where com. myclass is a class that is inside (and only inside) your target jar; if that throws a ClassNotFoundException , then the jar is not on you current classpath.
In Eclipse just do Ctrl-Click on the class name (in import sentence), then Right- Click on . class code, to open a dialog,·and finally chose Declarations-project.
If you have the jar in your class path / project path hit CTRL-SHIFT-T and type the name ... the jar will be displayed at the bottom.
If you haven't the class in your build path a) put together a dummy project containing all the jars b) I think there is a plugin to find jars from IBM Alphaworks (but that might be kind of outdated)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With