simple, yet powerfull

If you have ever run into class path, NoClassDefFoundError, or ClassNotFoundException related issues you will probably find this script useful.

This is very simple, yet powerful “dev toy”. All it does is going through the JAR file and look for particular class or package.


PACKAGE=`echo $2 | sed 's/\./\//g'`
SIZE=`jar -tf $1 | grep $PACKAGE | wc -l`

if [ $SIZE -ne 0 ]
  echo File: $1
  echo "-------------------------------------------------"
  for i in `jar -tf $1 | grep $PACKAGE`; do
    echo "$i"
  echo "-------------------------------------------------"

This script allows you to go through all the JARs you use, you might use or you might want to use. Putting it straight – it saves time.

The simplest way of using it follows:

shell> find . -name "*.jar" -exec {} "" \;

This way, you will get all the JARs that contain specified class.