private static IVMInstall getGhidraVm(AppConfig appConfig) throws IOException, CoreException {

		File requiredJavaHomeDir = appConfig.getSavedJavaHome(); // safe to assume it's valid

		// First look for a matching VM in Eclipse's existing list.
		// NOTE: Mac has its own VM type, so be sure to check it for VM matches too.
		IVMInstall vm = null;
		IVMInstallType standardType =
			JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE);
		IVMInstallType macType =
			JavaRuntime.getVMInstallType("org.eclipse.jdt.internal.launching.macosx.MacOSXType");
		if (standardType == null) {
			throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR,
				"Failed to find the standard Java VM type.", null));
		}
		for (IVMInstall existingVm : standardType.getVMInstalls()) {
			if (requiredJavaHomeDir.equals(existingVm.getInstallLocation())) {
				vm = existingVm;
				break;
			}
		}
		if (macType != null && vm == null) {
			for (IVMInstall existingVm : macType.getVMInstalls()) {
				if (requiredJavaHomeDir.equals(existingVm.getInstallLocation())) {
					vm = existingVm;
					break;
				}
			}
		}

		// If we didn't find a match, create a new standard type entry
		if (vm == null) {
			long unique = System.currentTimeMillis(); // This loop seems to be the accepted way to get a unique VM id
			while (standardType.findVMInstall(String.valueOf(unique)) != null) {
				unique++;
			}
			VMStandin vmStandin = new VMStandin(standardType, String.valueOf(unique));
			String dirName = requiredJavaHomeDir.getName();
			if (requiredJavaHomeDir.getAbsolutePath().contains("Contents/Home")) {
				dirName = requiredJavaHomeDir.getParentFile().getParentFile().getName();
			}
			vmStandin.setName(Activator.PLUGIN_ID + "_" + dirName);
			vmStandin.setInstallLocation(requiredJavaHomeDir);
			vm = vmStandin.convertToRealVM();
		}

		return vm;
	}
Gets the required VM used to build and run the Ghidra defined by the given layout.

@param appConfig Ghidra's application configuration.
@return The required VM used to build and run the Ghidra defined by the given layout.
@throws IOException If there was a file-related problem with getting the VM.
@throws CoreException If there was an Eclipse-related problem with creating the project.
GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/GhidraProjectUtils.java