Ghidra is a software reverse engineering (SRE) framework
GP-6399 Ensure we are not in headless mode for GUI launch. Headless apps should use headless config.
ghidra1050f7159ad3e
diff --git a/Ghidra/Debug/Debugger-isf/src/main/java/ghidra/dbg/isf/IsfServer.java b/Ghidra/Debug/Debugger-isf/src/main/java/ghidra/dbg/isf/IsfServer.javaindex 9ada15876c..f60cd30bce 100644--- a/Ghidra/Debug/Debugger-isf/src/main/java/ghidra/dbg/isf/IsfServer.java+++ b/Ghidra/Debug/Debugger-isf/src/main/java/ghidra/dbg/isf/IsfServer.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -27,7 +27,7 @@ import ghidra.GhidraApplicationLayout;import ghidra.GhidraTestApplicationLayout;import ghidra.base.project.GhidraProject;import ghidra.framework.Application;-import ghidra.framework.GhidraApplicationConfiguration;+import ghidra.framework.HeadlessGhidraApplicationConfiguration;import ghidra.framework.data.OpenMode;import ghidra.framework.model.DomainFile;import ghidra.framework.model.ProjectData;@@ -163,8 +163,8 @@ public class IsfServer extends Thread {public static void main(String[] args) throws FileNotFoundException, IOException {GhidraApplicationLayout layout =new GhidraTestApplicationLayout(new File(AbstractGTest.getTestDirectoryPath()));- GhidraApplicationConfiguration config = new GhidraApplicationConfiguration();- config.setShowSplashScreen(false);+ HeadlessGhidraApplicationConfiguration config =+ new HeadlessGhidraApplicationConfiguration();Application.initializeApplication(layout, config);IsfServer server = new IsfServer(null, 54321);diff --git a/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java b/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.javaindex 3f0c43c8ce..6ee372a5ec 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/framework/GhidraApplicationConfiguration.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -15,6 +15,8 @@*/package ghidra.framework;+import java.awt.GraphicsEnvironment;+import docking.DockingErrorDisplay;import docking.DockingWindowManager;import docking.framework.ApplicationInformationDisplayFactory;@@ -37,6 +39,16 @@ public class GhidraApplicationConfiguration extends HeadlessGhidraApplicationConprivate static final String USER_AGREEMENT_PROPERTY_NAME = "USER_AGREEMENT";private boolean showSplashScreen = true;+ public GhidraApplicationConfiguration() {+ if (GraphicsEnvironment.isHeadless()) {+ System.err.println(+ "ERROR: Unable to launch Ghidra GUI application in headless environment.");+ System.err.println(+ "If launching from a remote SSH shell, you must have an X11 compatible client with X11 forwarding enabled.");+ System.exit(1);+ }+ }+@Overridepublic boolean isHeadless() {return false;