Over a million developers have joined DZone.

ClassNotFoundException vs NoClassDefFoundError

DZone's Guide to

ClassNotFoundException vs NoClassDefFoundError

Free Resource

Build vs Buy a Data Quality Solution: Which is Best for You? Gain insights on a hybrid approach. Download white paper now!

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.

Build vs Buy a Data Quality Solution: Which is Best for You? Maintaining high quality data is essential for operational efficiency, meaningful analytics and good long-term customer relationships. But, when dealing with multiple sources of data, data quality becomes complex, so you need to know when you should build a custom data quality tools effort over canned solutions. Download our whitepaper for more insights into a hybrid approach.


Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}