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:
for i in `find . -name "*jar"`
jar tvf $i | grep $TARGET > /dev/null
if [ $? == 0 ]
echo "$TARGET is in $i"
Update: My colleague Chris Johnson just posted a better version of this, with some caching over at the Fusion Security Blog.
About Mark Nelson
Mark Nelson is a Developer Evangelist at Oracle, focusing on microservices and messaging. Before this role, Mark was an Architect in the Enterprise Cloud-Native Java Team, the Verrazzano Enterprise Container Platform project, worked on Wercker, WebLogic and was a senior member of the A-Team since 2010, and worked in Sales Consulting at Oracle since 2006 and various roles at IBM since 1994.
This entry was posted in Uncategorized
and tagged Tricks
. Bookmark the permalink
Pingback: Finding which JAR contains a class
Pingback: Finding which JAR contains a class – again! | RedStack