public class JarClassLoader extends URLClassLoader
Constructor and Description |
---|
JarClassLoader()
构造
|
JarClassLoader(URL[] urls)
构造
|
JarClassLoader(URL[] urls,
ClassLoader classLoader)
构造
|
Modifier and Type | Method and Description |
---|---|
JarClassLoader |
addJar(File jarFileOrDir)
加载Jar文件,或者加载目录
|
JarClassLoader |
addURL(File dir)
增加class所在目录或文件
如果为目录,此目录用于搜索class文件,如果为文件,需为jar文件 |
void |
addURL(URL url) |
static JarClassLoader |
load(File dir)
加载Jar到ClassPath
|
static JarClassLoader |
loadJar(File jarFile)
加载Jar到ClassPath
|
static void |
loadJar(URLClassLoader loader,
File jarFile)
加载Jar文件到指定loader中
|
static URLClassLoader |
loadJarToSystemClassLoader(File jarFile)
加载Jar文件到System ClassLoader中
|
close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
defineClass, defineClass
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public JarClassLoader()
public JarClassLoader(URL[] urls)
urls
- 被加载的URLpublic JarClassLoader(URL[] urls, ClassLoader classLoader)
urls
- 被加载的URLclassLoader
- 类加载器public static JarClassLoader load(File dir)
dir
- jar文件或所在目录public static JarClassLoader loadJar(File jarFile)
jarFile
- jar文件或所在目录public static void loadJar(URLClassLoader loader, File jarFile) throws UtilException
loader
- URLClassLoader
jarFile
- 被加载的jarUtilException
- IO异常包装和执行异常public static URLClassLoader loadJarToSystemClassLoader(File jarFile)
jarFile
- 被加载的jarpublic JarClassLoader addJar(File jarFileOrDir)
jarFileOrDir
- jar文件或者jar文件所在目录public void addURL(URL url)
addURL
in class URLClassLoader
public JarClassLoader addURL(File dir)
dir
- 目录Copyright © 2024. All rights reserved.