Package ghidra

Class GhidraClassLoader

All Implemented Interfaces:
Closeable, AutoCloseable

public class GhidraClassLoader extends 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 Details

    • GhidraClassLoader

      public GhidraClassLoader(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 Details

    • addURL

      public void addURL(URL url)
      Overrides:
      addURL in class URLClassLoader
    • addPath

      public boolean addPath(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: