NoClassDefFoundError
occurs when a class was found during compilation but could not be
located in the classpath while executing the program.
For
example: class A invokes method from class B and both compile fine but
before executing the program, an ANT script deleted B.class by mistake.
Now on executing the program NoClassDefFoundError is thrown.
ClassNotFoundException occurs when a class is not found while dynamically loading a class using the class loaders.
For example: The database driver is not found when trying to load the driver using Class.forName() method.
Posted in: