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.
@Nikita Rybak: AstroGrep for Windows is our friend: http://astrogrep.sourceforge.net/
I recently created a tool to search class , packages and libraries. You can try it http://javasearch.buggybread.com/. Click on the framework and it will help you locate dependency information ( jar , pom).
I usually employ bash for that:
grep -lr "ClassName" .
The trick is that names aren't encoded in any way. You can open jar file in text editor and you'll see them. (You can even include package name in search query.)I suspect, there's some windows equivalent too.
I tried some of those Unix commands, but they errored out for various reasons. Here's a Perl script I wrote. It's specifically designed to run on Cygwin using the Cygwin version of Perl.
I ran into the same problem countless times, so I wrote a little tool to find them.
A simple command line: findclass MyClass -classpath ...
It searches directories, jar, zip, war and ear files for your class. I wrote it a few years back and use it all the time. I thought others might find it useful too so I uploaded onto github.
It's freely available to download: https://github.com/eurozulu/Findclass/tree/master/dist
If you want to look at the source, it's in the same site: https://github.com/eurozulu/Findclass/tree/master
If you like it, just let me know to give me that warm comfy feeling :)
Just wanted to mention here that thirdparties can be searched for some specific file name in jarfinder Although it doesn't directly answer the question, but it won't harm :)
Hope this helps