java.lang

Class ClassNotFoundException

public class ClassNotFoundException extends Exception

Thrown when a class is requested by reflection, but the class definition cannot be found. This exception is often chained from another Throwable.

See Also: forName findSystemClass ClassLoader

UNKNOWN: updated to 1.4

Constructor Summary
ClassNotFoundException()
Create an exception without a message.
ClassNotFoundException(String s)
Create an exception with a message.
ClassNotFoundException(String s, Throwable ex)
Create an exception with a message and chain it to the exception which occurred while loading the class.
Method Summary
ThrowablegetCause()
Returns the exception which occurred while loading the class, otherwise returns null.
ThrowablegetException()
Returns the exception which occurred while loading the class, otherwise returns null.

Constructor Detail

ClassNotFoundException

public ClassNotFoundException()
Create an exception without a message. Note that this initializes the cause to null.

ClassNotFoundException

public ClassNotFoundException(String s)
Create an exception with a message. Note that this initializes the cause to null.

Parameters: s the message

ClassNotFoundException

public ClassNotFoundException(String s, Throwable ex)
Create an exception with a message and chain it to the exception which occurred while loading the class.

Parameters: s the message ex the chained exception

Since: 1.2

Method Detail

getCause

public Throwable getCause()
Returns the exception which occurred while loading the class, otherwise returns null.

Returns: the cause of this exception

Since: 1.4

getException

public Throwable getException()
Returns the exception which occurred while loading the class, otherwise returns null. This is a legacy method; the preferred choice now is {@link Throwable#getCause()}.

Returns: the cause of this exception

Since: 1.2