One of the way to resolve Java ClassNotFound Exception in Java Compilation
This Shell Script explores the given set of Jar(s) present in a directory and search for given Class inside the Jar file.
echo "#########################################"
echo "JarExplorer - The Java Jar file Explorer"
echo "#########################################"
echo " This utility searches Class inside a Jar File(s)"
echo -n "Enter the Path/folder contains jar file(s) : "
read jarPath
[ -d $jarPath ] && {
echo "Directory/Folder Exists"
cd $jarPath > /dev/null
echo -n "Enter the Class Name to Search :"
read classSearch
ls *.jar | \
while read afile
do
echo -n "Looking in "$afile
jar -tvf $afile > ClassList
sed 's/\//\./g' ClassList > ClassListOut
cat ClassListOut | grep -w $classSearch\.class | echo " : " $classSearch " Class exists !"
done
rm ClassList
rm ClassListOut
exit
}
echo "Invalid Directory"
# Sample org.apache.commons.collections.Bag