findinjar.sh

Which jar is the class in?


cat /home/andy/scripts/findinjar.sh
#usage ~/scripts/findinjar.sh directory classname

for jar in $(find $1 -name '*.jar'); do

if unzip -l $jar | grep $2 ; then

echo " found in $jar"

fi

done

For example: ~/scripts/findinjar.sh $JBOSS_HOME/server/default/lib Session

Or: find . -type d -exec $HOME/scripts/findinjar.sh '{}' PortalSession ';' - would find PortalSession class in any jar file located in a sub directory of the current directory.