public static HeadlessAnalyzer getInstance() throws IOException {

		// Prevent more than one headless analyzer from being instantiated.  Too much about it
		// messes with global system settings, so under the current design of Ghidra, allowing
		// more than one to exist could result in unpredictable behavior.
		if (instance != null) {
			return instance;
		}

		// Initialize application (if necessary)
		if (!Application.isInitialized()) {
			ApplicationConfiguration configuration = new HeadlessGhidraApplicationConfiguration();
			configuration.setInitializeLogging(false);
			Msg.setErrorLogger(new HeadlessErrorLogger(null));
			Application.initializeApplication(getApplicationLayout(), configuration);
		}

		// Instantiate and return singleton headless analyzer
		instance = new HeadlessAnalyzer();
		return instance;
	}
Gets a headless analyzer instance, with the assumption that the application has already been
initialized.  If this is called before the application has been initialized, it will
initialize the application with no logging.

@return An instance of a new headless analyzer.
@throws IOException if there was a problem reading the application.properties file (only possible
    if the application had not be initialized).
Ghidra/Features/Base/src/main/java/ghidra/app/util/headless/HeadlessAnalyzer.java