#!/bin/bash
# nasty script to find a string in the contents of a jar file.
# probably a better way to do this, but then again...
if [ "$1foo" = "foo" ] ; then
echo "$0 usage: `basename $0` string"
echo "where string is the string to look for in the jar's contents"
exit 1
fi
for i in `find . -name \*.jar`
do className=`(jar tvf $i | grep $1)`;
if [ "$className" != "" ]; then
echo -e "$i\t$className";
fi
done
To use it save the above code of to a file called 'whichJar' in your bin directory, and make it executable
chmod a+x whichJar
Then, for example to find the class 'javax.jms.Topic' in any of the jars in the current directory, or any of its subdirectories, simply type
whichJar javax.jms.Topic
Thank you Toby.
No comments:
Post a Comment