I often want to search through a large number of JAR files looking for a particular class, and every time I do this I wish I had some utility to make it easier. So I finally made one:
#!/bin/sh
TARGET="$1"
for i in `find . -name "*jar"`
do
jar tvf $i | grep $TARGET > /dev/null
if [ $? == 0 ]
then
echo "$TARGET is in $i"
fi
done
Update: My colleague Chris Johnson just posted a better version of this, with some caching over at the Fusion Security Blog.
Pingback: Finding which JAR contains a class
Pingback: Finding which JAR contains a class – again! | RedStack