Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

ClassNotFoundException vs NoClassDefFoundError

DZone's Guide to

ClassNotFoundException vs NoClassDefFoundError

Free Resource

Learn how to troubleshoot and diagnose some of the most common performance issues in Java today. Brought to you in partnership with AppDynamics.

I got a NoClassDefFoundError and I tried to remember the difference between this error and ClassNotFoundException. Unfortunately, I was not able to get the difference so I googled and got the following links:

- http://www.jroller.com/sjivan/entry/difference_between_classnotfoundexception_and_noclassdeffounderror

- http://javafanatics.blogspot.com/2007/03/noclassdeffounderror-vs.html 

  • NoClassDefFoundError is the result of the futile implicit load of the
    class (Class1). Meaning the system classloader is trying to load the
    class Class1 due to inherent call by Class2 (may be an inheritance or
    composition there).
  • ClassNotFoundException comes up when there is an explicit load, using ClassLoader.loadClass, Class.forName etc.

Understand the needs and benefits around implementing the right monitoring solution for a growing containerized market. Brought to you in partnership with AppDynamics.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}