java.lang
Class ClassNotFoundException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.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:
Class.forName(String), ClassLoader#findSystemClass(String), ClassLoader#loadClass(String, boolean)

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
 Throwable getCause()
          Returns the exception which occurred while loading the class, otherwise returns null.
 Throwable getException()
          Returns the exception which occurred while loading the class, otherwise returns null.
 
Methods inherited from class java.lang.Throwable
getLocalizedMessage, getMessage, initCause, printStackTrace, printStackTrace, printStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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

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 Throwable.getCause().

Returns:
the cause of this exception
Since:
1.2

getCause

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

Overrides:
getCause in class Throwable
Returns:
the cause of this exception
Since:
1.4