Difference between NoClassDefFoundException and ClassNotFoundException

  • NoClassDefFoundException is thrown if a class is referenced with Java’s “new” operator (i.e. static loading) but the runtime system cannot find the referenced class.

                  Ex: Employee e = new Employee();

  • ClassNotFoundException is thrown when an application tries to load in a class through its string name using the following methods but no definition for the class with the specified name could be found: 
    • The forName(..) method in class - Class.
    • The findSystemClass(..) method in class - ClassLoader.
    • The loadClass(..) method in class - ClassLoader

    Ex: Class employeeClass = Class.forName("com.samples.Employee") ;


Enter your email address to get our daily JOBS & INTERVIEW FAQ's Straight to your Inbox.

Make sure to activate your subscription by clicking on the activation link sent to your email