public class ClassLoaderUtil
extends java.lang.Object
ClassLoader utility.| Constructor and Description |
|---|
ClassLoaderUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.ClassLoader |
createClassloader(java.io.File libDir,
java.lang.ClassLoader cl)
Deprecated.
removal candidate, never used
|
static java.net.URLClassLoader |
createURLClassLoader(java.lang.String dirPath)
Construct a
URLClassLoader based on a canonical file location. |
static java.net.URLClassLoader |
createURLClassLoader(java.lang.String location,
java.lang.ClassLoader parent)
Construct a
URLClassLoader based on a canonical file location. |
static java.lang.Object |
load(java.lang.String clazzName)
Load a class using the current {link Thread#getContextClassLoader}
|
static java.lang.Object |
load(java.lang.String clazzName,
java.lang.ClassLoader classLoader)
Load a class using the provided
ClassLoader |
public static java.lang.ClassLoader createClassloader(java.io.File libDir,
java.lang.ClassLoader cl)
throws java.io.IOException
libDir - Directory with jars.cl - the parent ClassLoader, or null if none.URLClassLoader that can load classes from a directory that
contains jar and zip files.java.io.IOException - I/O failpublic static java.net.URLClassLoader createURLClassLoader(java.lang.String dirPath)
throws java.io.IOException
URLClassLoader based on a canonical file location.dirPath - a canonical path locationURLClassLoaderjava.io.IOException - I/Ojava.net.MalformedURLException - Invalid URLpublic static java.net.URLClassLoader createURLClassLoader(java.lang.String location,
java.lang.ClassLoader parent)
throws java.io.IOException
URLClassLoader based on a canonical file location.location - a canonical path locationparent - ClassLoader to be used as parent for returned one.URLClassLoaderjava.io.IOException - I/Ojava.net.MalformedURLException - Invalid URLpublic static java.lang.Object load(java.lang.String clazzName)
clazzName - The name of the class you want to load.public static java.lang.Object load(java.lang.String clazzName,
java.lang.ClassLoader classLoader)
ClassLoaderclazzName - The name of the class you want to load.classLoader - A classloader to use for loading a class.Copyright © 2013 Oracle Corporation. All Rights Reserved.