Package ghidra

Class GhidraLauncher


  • public class GhidraLauncher
    extends java.lang.Object
    Class used to prepare Ghidra for launching

    A main(String[]) method is provided which redirects execution to a GhidraLaunchable class passed in as a command line argument

    • Constructor Summary

      Constructors 
      Constructor Description
      GhidraLauncher()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.util.List<java.lang.String> findJarsInDir​(ResourceFile dir)
      Searches the given directory (non-recursively) for jars and returns their paths in a list.
      static GhidraApplicationLayout initializeGhidraEnvironment()
      Initializes the Ghidra environment by discovering its layout and adding all relevant modules and libraries to the classpath
      static void launch​(java.lang.String[] args)
      Launches the given GhidraLaunchable specified in the first command line argument
      static void main​(java.lang.String[] args)
      Deprecated, for removal: This API element is subject to removal in a future version.
      • Methods inherited from class java.lang.Object

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

      • GhidraLauncher

        public GhidraLauncher()
    • Method Detail

      • main

        @Deprecated(since="10.1",
                    forRemoval=true)
        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Deprecated, for removal: This API element is subject to removal in a future version.
        Launches the given GhidraLaunchable specified in the first command line argument
        Parameters:
        args - The first argument is the name of the GhidraLaunchable to launch. The remaining args get passed through to the class's GhidraLaunchable.launch(ghidra.GhidraApplicationLayout, java.lang.String[]) method.
        Throws:
        java.lang.Exception - If there was a problem launching. See the exception's message for more details on what went wrong.
      • initializeGhidraEnvironment

        public static GhidraApplicationLayout initializeGhidraEnvironment()
                                                                   throws java.io.IOException,
                                                                          java.lang.ClassNotFoundException
        Initializes the Ghidra environment by discovering its layout and adding all relevant modules and libraries to the classpath

        NOTE: This method expects that the GhidraClassLoader is the active classloader

        Returns:
        Ghidra's layout
        Throws:
        java.io.IOException - if there was an issue getting the layout
        java.lang.ClassNotFoundException - if the GhidraClassLoader is not the active classloader
      • findJarsInDir

        public static java.util.List<java.lang.String> findJarsInDir​(ResourceFile dir)
        Searches the given directory (non-recursively) for jars and returns their paths in a list. The paths will be sorted by jar file name.
        Parameters:
        dir - The directory to search for jars in
        Returns:
        A list of discovered jar paths, sorted by jar file name