What’s the difference between a ClassNotFoundException and NoClassDefFoundError?

Technology CommunityCategory: JavaWhat’s the difference between a ClassNotFoundException and NoClassDefFoundError?
VietMX Staff asked 4 years ago
  • ClassNotFoundException means the class file for a requested class is not on the classpath of the application.
  • NoClassDefFoundErrormeans that the class file existed at runtime, but for some reason the class could not be turned into a Class definition. A common cause is an exception being thrown in static initialization blocks.