src/java.base/share/classes/java/lang/ClassNotFoundException.java

Print this page




  80      */
  81     public ClassNotFoundException(String s) {
  82         super(s, null);  //  Disallow initCause
  83     }
  84 
  85     /**
  86      * Constructs a <code>ClassNotFoundException</code> with the
  87      * specified detail message and optional exception that was
  88      * raised while loading the class.
  89      *
  90      * @param s the detail message
  91      * @param ex the exception that was raised while loading the class
  92      * @since 1.2
  93      */
  94     public ClassNotFoundException(String s, Throwable ex) {
  95         super(s, null);  //  Disallow initCause
  96         this.ex = ex;
  97     }
  98 
  99     /**

















 100      * Returns the exception that was raised if an error occurred while
 101      * attempting to load the class. Otherwise, returns <tt>null</tt>.
 102      *
 103      * <p>This method predates the general-purpose exception chaining facility.
 104      * The {@link Throwable#getCause()} method is now the preferred means of
 105      * obtaining this information.
 106      *
 107      * @return the <code>Exception</code> that was raised while loading a class
 108      * @since 1.2
 109      */
 110     public Throwable getException() {
 111         return ex;
 112     }
 113 
 114     /**
 115      * Returns the cause of this exception (the exception that was raised
 116      * if an error occurred while attempting to load the class; otherwise
 117      * <tt>null</tt>).
 118      *
 119      * @return  the cause of this exception.


  80      */
  81     public ClassNotFoundException(String s) {
  82         super(s, null);  //  Disallow initCause
  83     }
  84 
  85     /**
  86      * Constructs a <code>ClassNotFoundException</code> with the
  87      * specified detail message and optional exception that was
  88      * raised while loading the class.
  89      *
  90      * @param s the detail message
  91      * @param ex the exception that was raised while loading the class
  92      * @since 1.2
  93      */
  94     public ClassNotFoundException(String s, Throwable ex) {
  95         super(s, null);  //  Disallow initCause
  96         this.ex = ex;
  97     }
  98 
  99     /**
 100      * Constructs a stack-less <code>ClassNotFoundException</code>
 101      * with the specified detail message, optional exception that was
 102      * raised while loading the class and the name of the throwing
 103      * entity (usually a runtime class name of the instance throwing
 104      * this exception).
 105      *
 106      * @param s the detail message
 107      * @param ex the exception that was raised while loading the class
 108      * @param wst whether or not the stack trace should be writable
 109      *            and filled-in
 110      */
 111     ClassNotFoundException(String s, Throwable ex, boolean wst) {
 112         super(s, null, true, wst);
 113         this.ex = ex;
 114     }
 115 
 116     /**
 117      * Returns the exception that was raised if an error occurred while
 118      * attempting to load the class. Otherwise, returns <tt>null</tt>.
 119      *
 120      * <p>This method predates the general-purpose exception chaining facility.
 121      * The {@link Throwable#getCause()} method is now the preferred means of
 122      * obtaining this information.
 123      *
 124      * @return the <code>Exception</code> that was raised while loading a class
 125      * @since 1.2
 126      */
 127     public Throwable getException() {
 128         return ex;
 129     }
 130 
 131     /**
 132      * Returns the cause of this exception (the exception that was raised
 133      * if an error occurred while attempting to load the class; otherwise
 134      * <tt>null</tt>).
 135      *
 136      * @return  the cause of this exception.