home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / lang / ClassNotFoundException.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  2.3 KB  |  81 lines

  1. /*
  2.  * @(#)ClassNotFoundException.java    1.6 98/03/18
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.lang;
  16.  
  17. /**
  18.  * Thrown when an application tries to load in a class through its 
  19.  * string name using:
  20.  * <ul>
  21.  * <li>The <code>forName</code> method in class <code>Class</code>.
  22.  * <li>The <code>findSystemClass</code> method in class
  23.  *     <code>ClassLoader</code> .
  24.  * <li>The <code>loadClass</code> method in class <code>ClassLoader</code>.
  25.  * </ul>
  26.  * <p>
  27.  * but no definition for the class with the specifed name could be found. 
  28.  *
  29.  * @author  unascribed
  30.  * @version 1.6, 03/18/98
  31.  * @see     java.lang.Class#forName(java.lang.String)
  32.  * @see     java.lang.ClassLoader#findSystemClass(java.lang.String)
  33.  * @see     java.lang.ClassLoader#loadClass(java.lang.String, boolean)
  34.  * @since   JDK1.0
  35.  */
  36. public
  37. class ClassNotFoundException extends Exception {
  38.     private Throwable ex;
  39.  
  40.     /**
  41.      * Constructs a <code>ClassNotFoundException</code> with no detail message.
  42.      */
  43.     public ClassNotFoundException() {
  44.     super();
  45.     }
  46.  
  47.     /**
  48.      * Constructs a <code>ClassNotFoundException</code> with the 
  49.      * specified detail message. 
  50.      *
  51.      * @param   s   the detail message.
  52.      */
  53.     public ClassNotFoundException(String s) {
  54.     super(s);
  55.     }
  56.  
  57.     /**
  58.      * Constructs a <code>ClassNotFoundException</code> with the
  59.      * specified detail message and optional exception that was
  60.      * raised while loading the class.
  61.      *
  62.      * @param s the detail message
  63.      * @param ex the exception that was raised while loading the class
  64.      * @since JDK1.2
  65.      */
  66.     public ClassNotFoundException(String s, Throwable ex) {
  67.     super(s);
  68.     this.ex = ex;
  69.     }
  70.  
  71.     /**
  72.      * Returns the exception that was raised if an error occurred while
  73.      * attempting to load the class. Otherwise, returns null.
  74.      *
  75.      * @since JDK1.2
  76.      */
  77.     public Throwable getException() {
  78.     return ex;
  79.     }
  80. }
  81.