首页 > 代码库 > 了解Java异常
了解Java异常
Java异常大体分两类:RuntimeException,其他;注意:两类异常都是在程序运行期间出现!只不过后者必须在编译期间进行处理,一般是try catch或throw;程序期间出现了此类异常时会执行catch和finally语句。而RuntimeException不必明确指出处理方式,大概更底层的虚拟机里有处理过程吧(这个我瞎猜的)。
1,NoClassDefFoundError
首先可以肯定的一点是,这不是ClassNotFoundException;JDK文档对NoClassDefFoundError的描述是
Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the
definition of a class (as part of a normal method call or as part of creating a new
instance using the new expression) and no definition of the class could be found.
The searched-for class definition existed when the currently executing class was compiled,
but the definition can no longer be found.直接点就是编译通过了,但是运行时,JVM或者类加载器想要加载类却找不到这个类。
解决BeanCreationException的办法:百度了半天解决不了,Bing搜索一下就出来了。以前只是听说Bing好用,今天算是体会到了。
了解Java异常