Class JarClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
dev.magicmq.pyspigot.manager.libraries.JarClassLoader
- All Implemented Interfaces:
Closeable
,AutoCloseable
Utility class for assisting with loading Jar files into the classpath.
-
Constructor Summary
ConstructorDescriptionJarClassLoader
(ClassLoader parentClassLoader) Initialize a new JarClassLoader using a parent class loader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addJarToClasspath
(Path file) Add a new Jar to the classpath.boolean
isJarInClassPath
(Path file) Check if a Jar file is in the classpath.Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getPermissions, getResourceAsStream, getURLs, newInstance, newInstance
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
JarClassLoader
Initialize a new JarClassLoader using a parent class loader.- Parameters:
parentClassLoader
- The parent class loader to use
-
-
Method Details
-
addJarToClasspath
Add a new Jar to the classpath.- Parameters:
file
- The Jar file to add to the classpath- Throws:
MalformedURLException
- If the file has an invalid URL
-
isJarInClassPath
Check if a Jar file is in the classpath.- Parameters:
file
- The Jar file to check- Returns:
- True if the Jar file is already in the classpath, false if otherwise
-