Find the jar file containing a class

13 Jan 2010

I often need to know which jar file contains a particular class and I'm sure most people have that problem at some point. You can use jarFinder but it's not always up-to-date or the class might be in a jar private to your organisation. You can use the following command to do a search on your file systems for all jars, and search in them for the class you're trying to find:

find -name *.jar -print -exec jar tvf {} \; | egrep "\.jar|<Class Name>"

Replace Class Name with the name of your class (Case sensitive). Use cygwin if you are on windows.