Over a million developers have joined DZone.

ClassNotFoundException vs NoClassDefFoundError

DZone's Guide to

ClassNotFoundException vs NoClassDefFoundError

Free Resource

Atomist automates your software deliver experience. It's how modern teams deliver modern software.

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.

Get the open source Atomist Software Delivery Machine and start automating your delivery right there on your own laptop, today!


Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}