当前位置: 首页>>代码示例>>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;未经允许,请勿转载。