public class ClassNotFoundException extends ReflectiveOperationException
类的forName方法。ClassLoader的findSystemClass方法。ClassLoader的loadClass方法。但没有找到指定名称的类的定义。
在1.4版本中,该异常已被更新以符合通用异常链机制。“可选的异常,而提高了加载的类,可以在施工时提供的并经getException()方法访问现在被称为零原因,可通过Throwable.getCause()方法访问,以及前述的“传统方法”。
| Constructor and Description |
|---|
ClassNotFoundException()
创建一个不含详细信息
ClassNotFoundException。
|
ClassNotFoundException(String s)
创建一个指定详细信息的
ClassNotFoundException。
|
ClassNotFoundException(String s, Throwable ex)
创建一个指定详细信息和可选的异常升高加载类的时候
ClassNotFoundException。
|
| Modifier and Type | Method and Description |
|---|---|
Throwable |
getCause()
返回该异常的原因(例外如果当试图加载类;发生错误引发,否则
null)。
|
Throwable |
getException()
返回在试图加载类时引发的异常,如果出现错误,则返回。
|
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic ClassNotFoundException()
ClassNotFoundException。
public ClassNotFoundException(String s)
ClassNotFoundException。
s -详细信息。
public Throwable getException()
这种方法在通用异常链设施。现在的Throwable.getCause()方法获取这一信息的首选方式。
异常加载一个类的时候
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.