public final class ExternalClassLoader extends ClassLoader
class loader caches loaded classes for
repeated requests. Also, if a .class file already exists for a specific .java sourcefile, the classloader will compare dates and see if
the .java needs recompiling. | Modifier and Type | Class and Description |
|---|---|
static class |
ExternalClassLoader.CompileException
Parameterized exception used when Java's runtime compiler fails to compile a Java source file.
|
| Constructor and Description |
|---|
ExternalClassLoader()
Constructor which initializes all properties.
|
| Modifier and Type | Method and Description |
|---|---|
Class<?> |
findClass(String className)
Loads a classfile from file in the following order:
looks for the java source and if available, checks whether it needs to be compiled
if no .java or .class file found, try to find it in the VM
If the class ultimately wasn't found a
ClassNotFoundException is being thrown. |
String |
getBasepath() |
ExternalClassLoader.CompileException |
getException() |
Class<?> |
loadClass(String className)
Loads a class from the classes cache if available.
|
void |
setBasepath(String basepath)
Sets the base path this classloader will look for classes in.
|
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatuspublic ExternalClassLoader()
@Nullable public final Class<?> loadClass(String className) throws ClassNotFoundException
findClass(String) otherwise.loadClass in class ClassLoaderClassNotFoundExceptionClassLoader.loadClass(String)@Nullable public final Class<?> findClass(String className) throws ClassNotFoundException
ClassNotFoundException is being thrown. If class was found, but an error
occurred, store exception for later review and return null. This is done so because the overridden method can't throw an
exception other than ClassNotFoundException.findClass in class ClassLoaderclassName - The path and name to the classfile.ClassNotFoundException - Thrown by ClassLoader.findSystemClass(String).public void setBasepath(String basepath)
basepath - A folder path to look for classes.public ExternalClassLoader.CompileException getException()
exceptionCopyright © 2018. All rights reserved.