ClassNotFoundException will most likely be thrown (in your code) in situations where you manually load the classes - just for things like Class.forName() . These names may come, for example, from user input.
NoClassDefFoundError will occur when the class file itself refers to a class, which then cannot be found. The class was present at some point, but now itโs not so - itโs not just an error in the code that it is trying to reflect, it is a deployment error so as not to make all the necessary classes available. As far as I can tell, a NoClassDefFoundError usually or perhaps always NoClassDefFoundError ClassNotFoundException , but the fact is that this is not what your code is designed to protect against, as it points to an environment that is probably too broken to recover from.
At least that's my understanding :)
Jon skeet
source share