Package info.freelibrary.util
Class JarClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- info.freelibrary.util.JarClassLoader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class JarClassLoader extends URLClassLoader
AURLClassLoader
for Jar files.
-
-
Constructor Summary
Constructors Constructor Description JarClassLoader(String aMainClassName)
Constructor for a Jar ClassLoader.JarClassLoader(URL[] aURLs, String aMainClassName)
Constructor for aClassLoader
for Jar files.JarClassLoader(List<URL> aListOfURLs, String aMainClassName)
Constructor for aClassLoader
for Jar files.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>
loadClass(String aName)
Loads theClass
for the supplied class name.-
Methods inherited from class java.net.URLClassLoader
close, findResource, findResources, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getDefinedPackage, getDefinedPackages, getName, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
-
-
-
-
Constructor Detail
-
JarClassLoader
public JarClassLoader(String aMainClassName) throws IOException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException
Constructor for a Jar ClassLoader.- Parameters:
aMainClassName
- A main class name to locate- Throws:
IOException
- If there is trouble reading the main classInstantiationException
- If there is a problem instantiating the main classIllegalAccessException
- If there is trouble accessing the main classClassNotFoundException
- If the main class cannot be foundNoSuchMethodException
InvocationTargetException
-
JarClassLoader
public JarClassLoader(URL[] aURLs, String aMainClassName) throws IOException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException
Constructor for aClassLoader
for Jar files.- Parameters:
aURLs
- An array of URLs to searchaMainClassName
- A main class name to locate- Throws:
IOException
- If there is trouble reading the main classIllegalAccessException
- If there is a problem accessing the main classInstantiationException
- If there is trouble instantiating the main classClassNotFoundException
- If the main class cannot be foundNoSuchMethodException
InvocationTargetException
-
JarClassLoader
public JarClassLoader(List<URL> aListOfURLs, String aMainClassName) throws IOException, IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException, ClassNotFoundException
Constructor for aClassLoader
for Jar files.- Parameters:
aListOfURLs
- AList
of URLs to searchaMainClassName
- A main class name to locate- Throws:
IOException
- If there is trouble reading the main classIllegalAccessException
- If there is a problem accessing the main classInstantiationException
- If there is trouble instantiating the main classClassNotFoundException
- If the main class cannot be foundNoSuchMethodException
InvocationTargetException
-
-
Method Detail
-
loadClass
public Class<?> loadClass(String aName) throws ClassNotFoundException
Loads theClass
for the supplied class name.- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
- If the class for the supplied name can't be found
-
-