Skip to content

Instantly share code, notes, and snippets.

@maheshagodekere
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maheshagodekere/18e8df55f057e0a52034 to your computer and use it in GitHub Desktop.
Save maheshagodekere/18e8df55f057e0a52034 to your computer and use it in GitHub Desktop.
Finding a class in jars
# prints name of the name of the jar
grep -l "classname" *.jar
# prints package of the class
find . -name "*.jar" -exec jar -t -f {} \; | grep "classname"
# list all the class files that match a given name:
find path/to/libs -name '*.jar' -exec grep -Hls <className> {} \;
# JAR could be anywhere in the system use locate and find command:
for i in $(locate "*.jar");
do echo $i; jar -tvf $i | grep -Hsi <classname>;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment