ClassNotFoundException
ClassNotFoundException This error, more common or understanding.
Reason: The specified class could not be found.
A common scenario is:
1 The specified class was not found when calling the Forname method of class
2 ClassLoader in the Findsystemclass () method, the specified class was not found
3 ClassLoader in the LoadClass () method, the specified class was not found
Java.lang.Class.java:
/** * Returns the <code>Class</code> object associated with the Class or * interface with the given string name. Invoking this method was * equivalent to: * * <blockquote><pre> * class.forname (ClassName, Tru E, currentloader) * </pre></blockquote> * * where <code>currentLoader</code> denotes t He defining class loader of * the current class. * * <p> For example, the following code fragment returns the * runtime <code>Class</code> DESCRI Ptor for the class named * <CODE>JAVA.LANG.THREAD</CODE>: * * <blockquote><pre> * class t = class.forname ("Java.lang.Thread") * </pre></blockquote> * <p> * A call to <tt>forname ("X") </tt> causes the class named * <tt>X</tt> to be initialized. * * @paramClassName The fully qualified name of the desired class. * @returnThe <code>Class</code> object for the Class with the * specified name. * @exceptionLinkageerror If the linkage fails *@exceptionExceptionininitializererror If the initialization provoked * by this method fails *@exceptionClassNotFoundException If the class cannot be located*/ Public StaticClass<?>forname (String className)throwsClassNotFoundException {returnFORNAME0 (ClassName,true, Classloader.getcallerclassloader ()); }
/***/ privatestaticnativeboolean Initialize, ClassLoader loader) throws ClassNotFoundException;
Noclassdeffounderror
This is more wonderful, looking for other information is that through the compilation, but when used, such as new when the error.
By finding the data, the following scenarios are collected:
Class 1-dependent classes or jars do not exist
Class 2 file exists, but exists in a different domain
3 case, Javac compile time is ignored size, it is likely that you compiled the class file is not the same as you want! This does not do validation.
Http://www.cnblogs.com/xing901022/p/4185514.html
The difference between java.lang.ClassNotFoundException and Java.lang.NoClassDefFoundError (turn)