public final class Loader extends Object
Modifier and Type | Method and Description |
---|---|
static ClassLoader |
getClassLoader()
Returns the ClassLoader to use.
|
static ClassLoader |
getClassLoader(Class<?> class1,
Class<?> class2) |
static URL |
getResource(String resource,
ClassLoader defaultLoader)
This method will search for
resource in different
places. |
static InputStream |
getResourceAsStream(String resource,
ClassLoader defaultLoader)
This method will search for
resource in different
places. |
static Class<?> |
loadClass(String className)
Load a Class by name.
|
public static ClassLoader getClassLoader()
public static ClassLoader getClassLoader(Class<?> class1, Class<?> class2)
public static URL getResource(String resource, ClassLoader defaultLoader)
resource
in different
places. The search order is as follows:
resource
using the thread context
class loader under Java2. If that fails, search for
resource
using the class loader that loaded this
class (Loader
). Under JDK 1.1, only the the class
loader that loaded this class (Loader
) is used.
ClassLoader.getSystemResource(resource)
, that is is
using the system class loader in JDK 1.2 and virtual machine's
built-in class loader in JDK 1.1.
resource
- The resource to load.defaultLoader
- The default ClassLoader.public static InputStream getResourceAsStream(String resource, ClassLoader defaultLoader)
resource
in different
places. The search order is as follows:
resource
using the thread context
class loader under Java2. If that fails, search for
resource
using the class loader that loaded this
class (Loader
). Under JDK 1.1, only the the class
loader that loaded this class (Loader
) is used.
ClassLoader.getSystemResource(resource)
, that is is
using the system class loader in JDK 1.2 and virtual machine's
built-in class loader in JDK 1.1.
resource
- The resource to load.defaultLoader
- The default ClassLoader.public static Class<?> loadClass(String className) throws ClassNotFoundException
className
- The class name.ClassNotFoundException
- if the Class could not be found.Copyright © 1999-2014 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.