#!/bin/ksh
#this script is used to find class in which jar file
if [ "$#" -le "1" ]; then
echo "Usage: $0 class_name jar_path_1 [jar_path2]...[jar_pathn]"
exit 1
fi
#class to be found
CLASS=$1
shift 1
for JAR in $*
do
if [ -d ${JAR} ]
then
JARS=`find ${JAR} -name "*.jar"`
else
JARS=${JAR}
fi
FOUND=""
for EACHJAR in ${JARS}
do
FOUND=$(jar tf ${EACHJAR}|grep ${CLASS})
if [ "x${FOUND}" != "x" ]
then
echo "-----------------------------------"
echo ${CLASS} was found in ${EACHJAR}
echo ${FOUND}|tr " " "\n"|grep -v .classPK
fi
done
done
exit 0