Find your class in JAR files
Some time ago I’ve posted about using multiple -exec options for find command which can be used to find in what JARs particular class lies. Below you can find enriched and more intuitive/detailed solution for finding your class in a bunch of JARs: #!/bin/bash if [ $# -lt 1 ] then echo 'Usage: jarfind CLASS_NAME [DIR_WITH_JARS]'; exit 1; fi WHAT="$1" if [ $# -eq 2 ] then WHERE="$2" else WHERE="." fi FIND_RESULT=`find "$WHERE" -maxdepth 2 -name '*.jar' -type f` for LINE in $FIND_RESULT do grep -q "$WHAT" "$LINE" if [ $? -eq 0 ] then echo "$LINE" jar tvf "$LINE" | grep "$WHAT" echo fi done The first argument is the class name you want to search for and the second one is the directory in which the jar files should be located (relative to the current directory). If the second argument is not specified, it defaults to current directory. ...