本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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);
}