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.
Related
About Mark Nelson
Mark Nelson is a Developer Evangelist at Oracle, focusing on microservices and AI. Mark has served as a Section Leader in Stanford's Code in Place program that has introduced tens of thousands of people to the joy of programming, he is a published author, a reviewer and contributor, a content creator and a lifelong learner. He enjoys traveling, meeting people and learning about foods and cultures of the world. Mark has worked at Oracle since 2006 and before that at IBM since 1994.
Pingback: Finding which JAR contains a class
Pingback: Finding which JAR contains a class – again! | RedStack