Package ghidra

Class GhidraClassLoader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class GhidraClassLoader
    extends java.net.URLClassLoader
    Custom Ghidra URL class loader which exposes the addURL method so we can add to the classpath at runtime.

    This class loader must be installed by setting the "java.system.class.loader" system property prior to launch (i.e., the JVM should be launched with the following argument: -Djava.system.class.loader=ghidra.GhidraClassLoader.

    • Constructor Summary

      Constructors 
      Constructor Description
      GhidraClassLoader​(java.lang.ClassLoader parent)
      This one-argument constructor is required for the JVM to successfully use this class loader via the java.system.class.loader system property.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addPath​(java.lang.String path)
      Converts the specified path to a URL and adds it to the classpath.
      void addURL​(java.net.URL url)  
      • Methods inherited from class java.net.URLClassLoader

        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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GhidraClassLoader

        public GhidraClassLoader​(java.lang.ClassLoader parent)
        This one-argument constructor is required for the JVM to successfully use this class loader via the java.system.class.loader system property.
        Parameters:
        parent - The parent class loader for delegation
    • Method Detail

      • addURL

        public void addURL​(java.net.URL url)
        Overrides:
        addURL in class java.net.URLClassLoader
      • addPath

        public boolean addPath​(java.lang.String path)
        Converts the specified path to a URL and adds it to the classpath.
        Parameters:
        path - The path to be added.
        Returns:
        True if the path was successfully added; otherwise, false. Failure can occur if the path is not able to be converted to a URL.
        See Also:
        addURL(URL)