What is your favorite tool, plugin, script, to find a java class in a bunch of jar files?
Very often I inherit code that complains about a class that doesn't exist, and it is just because the jar file is not included in the classpath. But, in what jar file(s) is the class? I may not have the JAR (so I have to search online), or adding a JAR to the classpath could create a duplicated class definition problem.
I obviously would prefer an eclipse plugin, but I'm open to any piece of software that works with Windows.
I know... Windows is not my choice, but that's what I got to work with.
Thanks!
Luis
P.S. Thank you for your answers. After reviewing some responses, I became aware that I should have explained better my scenario. We had a library of downloaded or created JAR files, but sometimes the class would be online somewhere.
In the same lines as BalusC's answer (I can't post comment yet nor link 2 urls, no reputation :( ), you can find a jar thanks to these 2 jar finder engines: - http://www.jarfinder.com/ - findjar
A simpler command. You don't have to use 'while-do', use '&&' to print file name if 'grep' finds the class.
I use jarscan. It is an executable jar file that can recursively search an entire folder structure for jars that contain the class that you are looking for. It searches by class name, package name or regex.
I have written a program for this: https://github.com/javalite/jar-explorer It will also decompile existing byte code to show you interfaces, methods, super classes, will show contents of other resources - text, images, html, etc.
If it's not in the classpath, then you likely don't have the JAR file itself at all. Searching via Eclipse's builtin
Ctrl+Shift+T
function won't help much. Usually you can make use of the package name to "guess" where you could get the JAR file from at the internet. E.g. aorg.apache.commons.lang.XXX
class is available at http://commons.apache.org/lang.For the unobvious ones, I myself use http://grepcode.com, the JAR source code search engine.