Ghidra is a software reverse engineering (SRE) framework
GP-0: Force Java to run in headless mode when Ghidra is launched from analyzeHeadless script
Ryan Kurtz824723e49260
diff --git a/Ghidra/Framework/Utility/src/main/java/ghidra/Ghidra.java b/Ghidra/Framework/Utility/src/main/java/ghidra/Ghidra.javaindex 8fd5235332..5c9e5ce985 100644--- a/Ghidra/Framework/Utility/src/main/java/ghidra/Ghidra.java+++ b/Ghidra/Framework/Utility/src/main/java/ghidra/Ghidra.java@@ -41,7 +41,9 @@ public class Ghidra {// fully qualified class name (with . replaced by -). If we don't do this here, the next// time it gets done is in a new thread, which results in the application name being set to// "java-lang-thread".- Taskbar.isTaskbarSupported();+ if (!Boolean.getBoolean("java.awt.headless")) {+ Taskbar.isTaskbarSupported();+ }// Forward args to GhidraLauncher, which will perform the launchGhidraLauncher.launch(args);diff --git a/Ghidra/RuntimeScripts/Linux/support/analyzeHeadless b/Ghidra/RuntimeScripts/Linux/support/analyzeHeadlessindex b535227e61..abd6681c23 100755--- a/Ghidra/RuntimeScripts/Linux/support/analyzeHeadless+++ b/Ghidra/RuntimeScripts/Linux/support/analyzeHeadless@@ -15,10 +15,13 @@ LAUNCH_MODE=fg# NOTE: This variable is ignored if not launching in a debugging mode.DEBUG_ADDRESS=127.0.0.1:13002+# Run Java in headless mode+VMARG_LIST="-Djava.awt.headless=true "+# Limit the # of garbage collection and JIT compiler threads in case many headless# instances are run in parallel. By default, Java will assign one thread per core# which does not scale well on servers with many cores.-VMARG_LIST="-XX:ParallelGCThreads=2 "+VMARG_LIST+="-XX:ParallelGCThreads=2 "VMARG_LIST+="-XX:CICompilerCount=2 "# Resolve symbolic link if present and get the directory this script lives in.diff --git a/Ghidra/RuntimeScripts/Windows/support/analyzeHeadless.bat b/Ghidra/RuntimeScripts/Windows/support/analyzeHeadless.batindex a8e027dec6..5fc98282a7 100644--- a/Ghidra/RuntimeScripts/Windows/support/analyzeHeadless.bat+++ b/Ghidra/RuntimeScripts/Windows/support/analyzeHeadless.bat@@ -16,10 +16,13 @@ set LAUNCH_MODE=fg:: NOTE: This variable is ignored if not launching in a debugging mode.set DEBUG_ADDRESS=127.0.0.1:13002+:: Run Java in headless mode+set VMARG_LIST=-Djava.awt.headless=true+:: Limit the # of garbage collection and JIT compiler threads in case many headless:: instances are run in parallel. By default, Java will assign one thread per core:: which does not scale well on servers with many cores.-set VMARG_LIST=-XX:ParallelGCThreads=2+set VMARG_LIST=%VMARG_LIST% -XX:ParallelGCThreads=2set VMARG_LIST=%VMARG_LIST% -XX:CICompilerCount=2:: Store current path (%0 gets modified below by SHIFT)