NoClassDefFoundError extends LinkageError which in turns extends Error.
Javadoc for Error class states:
An
Erroris a subclass ofThrowablethat indicates serious problems that a reasonable application should not try to catch.
Class loading methods like Class.forName() only declares ClassNotFoundException in throws clause. Which, in addition to above description of Error means that we should not be usually catching the NoClassDefFoundError when loading classes with Class.forName() etc.
My question is what are the conditions in which NoClassDefFoundError is thrown instead of ClassNotFoundException?