Skip to content

Monthly Archives: May 2008

Grepping for classes in jars

There are more robust apps out there that find a Java class given a bunch of jars, but I mostly use this script. Usage is:

jargrep ClassName /scratch/a/dir/with/jars

Script:

#!/bin/bash
# usage: jargrep searchstring dir

for jar in `find $2 -name '*.jar' -type f`
do
echo $jar
jar tvf $jar | grep "$1"
done

I leave the echo of each [...]