Tuesday, October 16, 2012

Find Class in .jar files

So I had a load of .jar files and was looking for a specific class that should be contain in one of them. I found you can run the following command to search for a class file:

find -name "*.jar" -exec sh -c 'unzip -l "{}" | grep -q <class name>' \; -print

Just replace <class name> with the class name e.g. 

find -name "*.jar" -exec sh -c 'unzip -l "{}" | grep -q HttpServletRequest' \; -print

Ref: http://unix.stackexchange.com/questions/25503/looking-for-a-java-class-in-a-set-of-jars-with-find-unzip-grep

No comments:

Followers