Skip to content

Instantly share code, notes, and snippets.

@stigkj
Forked from matthewmccullough/findjars.bsh
Created April 14, 2010 15:23
Show Gist options
  • Save stigkj/365920 to your computer and use it in GitHub Desktop.
Save stigkj/365920 to your computer and use it in GitHub Desktop.
Find class in all jars recursively
#!/bin/sh
#Example Usage: findjars com/ambientideas/groovy
CLASSNAMETOFIND="$1"
echo "Searching all JARs recursively..."
for eachjar in `find . -iname "*.jar"`
do
#echo "Searching in $eachjar ..."
jar tvf $eachjar | grep $CLASSNAMETOFIND > /dev/null
if [ $? == 0 ]
then
echo "******* Located \"$CLASSNAMETOFIND\" in $eachjar *******"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment