@Override
	public void launch(GhidraApplicationLayout layout, String[] args) {
		
		// Initialize the application
		ApplicationConfiguration configuration = new HeadlessGhidraApplicationConfiguration();
		Application.initializeApplication(layout, configuration);
		
		// Setup jython home directory
		try {
			JythonUtils.setupJythonHomeDir();
		}
		catch (IOException e) {
			Msg.showError(JythonRun.class, null, "Jython home directory", e.getMessage());
			System.exit(1);
		}

		// Setup jython cache directory
		try {
			JythonUtils.setupJythonCacheDir(configuration.getTaskMonitor());
		}
		catch (IOException e) {
			Msg.showError(JythonRun.class, null, "Jython cache directory", e.getMessage());
			System.exit(1);
		}
		catch (CancelledException e) {
			Msg.showError(JythonRun.class, null, "Operation cancelled", e.getMessage());
			System.exit(1);
		}
		
		// Pass control to Jython
		jython.main(args);
	}
Launcher entry point for running Ghidra from within Jython.
Ghidra/Features/Jython/src/main/java/ghidra/jython/JythonRun.java