當前位置: 首頁>>代碼示例>>Java>>正文


Java JavaRuntime.getVMInstallType方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.launching.JavaRuntime.getVMInstallType方法的典型用法代碼示例。如果您正苦於以下問題:Java JavaRuntime.getVMInstallType方法的具體用法?Java JavaRuntime.getVMInstallType怎麽用?Java JavaRuntime.getVMInstallType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.launching.JavaRuntime的用法示例。


在下文中一共展示了JavaRuntime.getVMInstallType方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getVMInstall

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
public IVMInstall getVMInstall() {
	if (getVMInstallTypeId() == null)
		return JavaRuntime.getDefaultVMInstall();
	try {
		IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
		IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
		int size = vmInstalls.length;
		String id = getVMInstallId();
		for (int i = 0; i < size; i++) {
			if (id.equals(vmInstalls[i].getId()))
				return vmInstalls[i];
		}
	}
	catch (Exception e) {
		// ignore
	}
	return null;
}
 
開發者ID:eclipse,項目名稱:cft,代碼行數:19,代碼來源:CloudFoundryServerRuntime.java

示例2: getVMInstall

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
public IVMInstall getVMInstall()
{
    if (getVMInstallTypeId() == null)
        return JavaRuntime.getDefaultVMInstall();
    try
    {
        IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
        IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
        int size = vmInstalls.length;
        String id = getVMInstallId();
        for (int i = 0; i < size; i++)
        {
            if (id.equals(vmInstalls[i].getId()))
                return vmInstalls[i];
        }
    }
    catch (Exception e)
    {
        JettyPlugin.log(e);
    }
    
    return null;
}
 
開發者ID:bengalaviz,項目名稱:JettyWTPPlugin,代碼行數:24,代碼來源:JettyRuntime.java

示例3: configureVM

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
public boolean configureVM() throws CoreException {
	String javaHome = preferenceManager.getPreferences().getJavaHome();
	if (javaHome != null) {
		File jvmHome = new File(javaHome);
		if (jvmHome.isDirectory()) {
			IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
			File location = defaultVM.getInstallLocation();
			if (!location.equals(jvmHome)) {
				IVMInstall vm = findVM(jvmHome);
				if (vm == null) {
					IVMInstallType installType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE);
					long unique = System.currentTimeMillis();
					while (installType.findVMInstall(String.valueOf(unique)) != null) {
						unique++;
					}
					String vmId = String.valueOf(unique);
					VMStandin vmStandin = new VMStandin(installType, vmId);
					String name = StringUtils.defaultIfBlank(jvmHome.getName(), "JRE");
					vmStandin.setName(name);
					vmStandin.setInstallLocation(jvmHome);
					vm = vmStandin.convertToRealVM();
				}
				JavaRuntime.setDefaultVMInstall(vm, new NullProgressMonitor());
				JDTUtils.setCompatibleVMs(vm.getId());
				return true;
			}
		}
	}
	return false;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:31,代碼來源:JDTLanguageServer.java

示例4: testDefaultVM

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
@Test
public void testDefaultVM() throws CoreException {
	String oldJavaHome = prefManager.getPreferences().getJavaHome();
	IVMInstall oldVm = JavaRuntime.getDefaultVMInstall();
	assertNotNull(oldVm);
	try {
		IVMInstall vm = null;
		IVMInstallType type = JavaRuntime.getVMInstallType(TestVMType.VMTYPE_ID);
		IVMInstall[] installs = type.getVMInstalls();
		for (IVMInstall install : installs) {
			if (!install.equals(oldVm)) {
				vm = install;
				break;
			}
		}
		assertNotNull(vm);
		assertNotEquals(vm, oldVm);
		String javaHome = new File(TestVMType.getFakeJDKsLocation(), "9").getAbsolutePath();
		prefManager.getPreferences().setJavaHome(javaHome);
		boolean changed = server.configureVM();
		IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
		assertTrue("A VM hasn't been changed", changed);
		assertEquals(vm, defaultVM);
		assertNotEquals(oldVm, defaultVM);
	} finally {
		prefManager.getPreferences().setJavaHome(oldJavaHome);
		TestVMType.setTestJREAsDefault();
	}
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:30,代碼來源:JDTLanguageServerTest.java

示例5: setTestJREAsDefault

import org.eclipse.jdt.launching.JavaRuntime; //導入方法依賴的package包/類
public static void setTestJREAsDefault() throws CoreException {
	IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(VMTYPE_ID);
	IVMInstall testVMInstall = vmInstallType.findVMInstall("1.8");
	if (!testVMInstall.equals(JavaRuntime.getDefaultVMInstall())) {
		// set the 1.8 test JRE as the new default JRE
		JavaRuntime.setDefaultVMInstall(testVMInstall, new NullProgressMonitor());
	}
	JDTUtils.setCompatibleVMs(VMTYPE_ID);
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:10,代碼來源:TestVMType.java


注:本文中的org.eclipse.jdt.launching.JavaRuntime.getVMInstallType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。