public final class LazyClassLoader extends URLClassLoader
Robot class loader. To address tightened security introduced in Java 9 all classes relying on dynamically loaded libraries (JAR files) must be instantiated using this loader.
The class was redesigned in v7.0.2 to enable loading of complicated plugins
from alternative locations (RB-648). It is now being used as the default JVM
system class loader injected through the
-Djava.system.class.loader=com.tplan.robot.util.LazyClassLoader
CLI option.
T-Plan Robot Enterprise, (C) 2009-2025 T-Plan Limited. All rights reserved.
Constructor and Description |
---|
LazyClassLoader(ClassLoader parent)
Constructor.Required when this class loader is used as the system class
loader.
|
LazyClassLoader(String name,
ClassLoader parent)
Constructor.
|
LazyClassLoader(String name,
URL[] urls,
ClassLoader parent) |
Modifier and Type | Method and Description |
---|---|
static void |
addPluginPath(String paths)
Add a path or paths containing Robot plugins.
|
static void |
addResource(File f)
Add a file to the class path.
|
static void |
addResource(URL u)
Add a file resource.
|
void |
addURL(URL url)
Add a URL to this class loader.
|
static Class |
forName(String clazz)
Load a class by name.
|
static ClassLoader |
getInstance()
Get shared loader instance.
|
static boolean |
isJava9()
Indicate whether Java is version 9 or higher.
|
static boolean |
isJGraphXMissing()
Indicate if the JGraphX library is loaded or missing.
|
static boolean |
testLibs(StringBuilder b,
boolean html) |
String |
toString() |
close, findResource, findResources, getResourceAsStream, getURLs, newInstance, newInstance
clearAssertionStatus, getParent, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
public LazyClassLoader(String name, ClassLoader parent)
name
- loader name.parent
- parent class loader.public LazyClassLoader(ClassLoader parent)
parent
- parent class loader.public LazyClassLoader(String name, URL[] urls, ClassLoader parent)
public static boolean isJava9()
public static boolean isJGraphXMissing()
public static ClassLoader getInstance()
public static Class forName(String clazz) throws ClassNotFoundException
clazz
- the class name.ClassNotFoundException
- when the class can not be loaded.public static boolean testLibs(StringBuilder b, boolean html)
public static void addResource(URL u)
u
- a file URL.public static void addResource(File f)
f
- a file.public static void addPluginPath(String paths)
paths
- a path or local ODS path separator separated paths.public void addURL(URL url)
addURL
in class URLClassLoader
url
- a URL.