I have gone through this thread What causes and what are the differences between NoClassDefFoundError and ClassNotFoundException? This is what one of the ans,which has max u
The difference depends on who asked the class to be loaded:
ClassNotFoundException is thrown when the code is directly trying to load a class, passing the String argument representing a Fully Qualified Name of the class.
Class.forName(String), or ClassLoader.loadClass(String).NoClassDefFoundError is thrown when the JVM is asked to load a class indirectly.
NoClassDefFoundError will be thrown.