Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AJLoveChina/01474c06b3ba461afd060e2f59762a03 to your computer and use it in GitHub Desktop.
Save AJLoveChina/01474c06b3ba461afd060e2f59762a03 to your computer and use it in GitHub Desktop.
Difference Between ClassNotFoundException Vs NoClassDefFoundError In Java
In Java, both ClassNotFoundException and NoClassDefFoundError occur when a particular class is not found at run time.
But, they occur at different scenarios. ClassNotFoundException is an exception which occurs when you try to load a class
at run time using Class.forName() or loadClass() methods and mentioned classes are not found in the classpath.
On the other hand, NoClassDefFoundError is an error which occurs when a particular class is present at compile time
but it was missing at run time. In this tutorial, we will see the differences between ClassNotFoundException Vs NoClassDefFoundError
in java and when they occur.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment