How to search fully qualified java class name for jar file

I am pretty sure that every java developer were in the situation when he was searching for a java archive file having fully qualified class name.

Java fully qualified class name

Fully qualified name is enough info to get this kind of issue resolved. You can either take advantage of sites like or features of IDE – search for class. Those approaches works well when missing class is from open source or at least from publicly available jar libraries. If the jar is already in your project but just missing item on the classpath – then the second case is applicable. But then there is vast amount of cases when you are searching for a library from vendor specific product which consists of huge amount of jar files. One way to find a class is to import all those libs to the IDE and then look up for a required class. This approach is a bit awkward. More straightforward approach is to search through product’s filesystem directly. One handy bash script follows – in this case searching for

for i in 'find ./  -name "*.jar"'
result='$JAVA_HOME/bin/jar -tvf $i'
echo $result | grep -i >dev/null
if[$? == 0]; then
echo $i;

Run this bash from the product’s root folder – all jars containing required class will be listed.


1 thought on “How to search fully qualified java class name for jar file

  1. Good idea. But it doesn’t work for me 😉 I have to made some syntax corrections. I guess that this should work better:

    for i in `find ./ -name “*.jar”`; do result=`$JAVA_HOME/bin/jar -tvf $i`; echo $result | grep javax.xml.bind > /dev/null; if [ $? == 0 ]; then echo $i; fi; done

    (Check for ` instead of ‘, space after if, missing leading slash at dev/null and so on)

    But once more: nice post! 🙂 Thanks


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s