ClassNotFoundException.java in  » JDK-Core » lang » java » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. JDK Core
2. JDK Modules
3. JDK Modules com.sun
4. JDK Modules com.sun.java
5. JDK Modules Platform
6. JDK Modules sun
7. Open Source Graphic Library
8. Open Source IDE Eclipse
9. Open Source J2EE
10. Open Source JBOSS
11. Open Source JDBC Driver
12. Open Source Library
13. Open Source Library Database
14. Open Source Net
15. Science
16. Sevlet Container
17. SUN GlassFish
18. Swing Library
19. Web Services apache cxf 2.0.1
20. Web Services AXIS2
21. XML
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Java Source Code / Java Documentation » JDK Core » lang » java.lang 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1995-2004 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:
026:        package java.lang;
027:
028:        /**
029:         * Thrown when an application tries to load in a class through its 
030:         * string name using:
031:         * <ul>
032:         * <li>The <code>forName</code> method in class <code>Class</code>.
033:         * <li>The <code>findSystemClass</code> method in class
034:         *     <code>ClassLoader</code> .
035:         * <li>The <code>loadClass</code> method in class <code>ClassLoader</code>.
036:         * </ul>
037:         * <p>
038:         * but no definition for the class with the specified name could be found. 
039:         *
040:         * <p>As of release 1.4, this exception has been retrofitted to conform to
041:         * the general purpose exception-chaining mechanism.  The "optional exception
042:         * that was raised while loading the class" that may be provided at
043:         * construction time and accessed via the {@link #getException()} method is
044:         * now known as the <i>cause</i>, and may be accessed via the {@link
045:         * Throwable#getCause()} method, as well as the aforementioned "legacy method."
046:         *
047:         * @author  unascribed
048:         * @version 1.27, 05/05/07
049:         * @see     java.lang.Class#forName(java.lang.String)
050:         * @see     java.lang.ClassLoader#findSystemClass(java.lang.String)
051:         * @see     java.lang.ClassLoader#loadClass(java.lang.String, boolean)
052:         * @since   JDK1.0
053:         */
054:        public class ClassNotFoundException extends Exception {
055:            /**
056:             * use serialVersionUID from JDK 1.1.X for interoperability
057:             */
058:            private static final long serialVersionUID = 9176873029745254542L;
059:
060:            /**
061:             * This field holds the exception ex if the 
062:             * ClassNotFoundException(String s, Throwable ex) constructor was
063:             * used to instantiate the object
064:             * @serial 
065:             * @since 1.2
066:             */
067:            private Throwable ex;
068:
069:            /**
070:             * Constructs a <code>ClassNotFoundException</code> with no detail message.
071:             */
072:            public ClassNotFoundException() {
073:                super ((Throwable) null); // Disallow initCause
074:            }
075:
076:            /**
077:             * Constructs a <code>ClassNotFoundException</code> with the 
078:             * specified detail message. 
079:             *
080:             * @param   s   the detail message.
081:             */
082:            public ClassNotFoundException(String s) {
083:                super (s, null); //  Disallow initCause
084:            }
085:
086:            /**
087:             * Constructs a <code>ClassNotFoundException</code> with the
088:             * specified detail message and optional exception that was
089:             * raised while loading the class.
090:             *
091:             * @param s the detail message
092:             * @param ex the exception that was raised while loading the class
093:             * @since 1.2
094:             */
095:            public ClassNotFoundException(String s, Throwable ex) {
096:                super (s, null); //  Disallow initCause
097:                this .ex = ex;
098:            }
099:
100:            /**
101:             * Returns the exception that was raised if an error occurred while
102:             * attempting to load the class. Otherwise, returns <tt>null</tt>.
103:             *
104:             * <p>This method predates the general-purpose exception chaining facility.
105:             * The {@link Throwable#getCause()} method is now the preferred means of
106:             * obtaining this information.
107:             *
108:             * @return the <code>Exception</code> that was raised while loading a class
109:             * @since 1.2
110:             */
111:            public Throwable getException() {
112:                return ex;
113:            }
114:
115:            /**
116:             * Returns the cause of this exception (the exception that was raised
117:             * if an error occurred while attempting to load the class; otherwise
118:             * <tt>null</tt>).
119:             *
120:             * @return  the cause of this exception.
121:             * @since   1.4
122:             */
123:            public Throwable getCause() {
124:                return ex;
125:            }
126:        }
w___w_w__.__j_ava__2__s___.___c_o___m___
Home | Contact Us
Copyright 2003 - 07 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.