Jar Scanning

Sometimes it can be helpful to track down where exactly a class is within a library of jars.

One means of doing it is to run something like the following from the command line:

find . -name \*jar -print -exec jar -tvf {} \; | nawk '/YOURSEARCHSTRING/ || /jar/ {print} '

Another means is to use a java based jarscan tool.
The tool comes with a .bat file, which is not exactly ideal for linux development.
I created an equivalent .sh file with the following contents:

java -jar $JARSCAN_HOME/jarscan.jar $1 $2

and added an alias to my ~/.bashrc file of the form:

alias jarscan='~/dev/apps/jarscan/jarscan.sh'

Now you have a command line jarscanner. Navigate to any directory, and to run a recursive jar search enter a short command like the following:

jarscan MBeanServer


Post a Comment

Popular posts from this blog

AngularJs: User friendly date display with AngularJs and MomentJs

Nerd Tree: A File Explorer with Mac Vim

Getting started with Grails functional tests using Geb + Spock