/** * Determines if the vm version will run the currently compiled code based on the compiler compliance lvl * @param vm the vm install * @param compliance the current compiler compliance level * @return true if the selected vm will run the current code, false otherwise * @since 3.3 */ private boolean supportsCurrentCompliance(IVMInstall vm, String compliance) { if(vm instanceof AbstractVMInstall) { AbstractVMInstall install = (AbstractVMInstall) vm; String vmver = install.getJavaVersion(); if(vmver == null) { //if we cannot get a version from the VM we must return true, and let the runtime //error sort it out return true; } int val = compliance.compareTo(vmver); return val < 0 || val == 0; } return false; }
@Override public int hashCode() { return getVMInstallType().hashCode() + getId().hashCode(); }
@Override public String[] getVMArguments() { String args = getVMArgs(); if (args == null) { return null; } ExecutionArguments ex = new ExecutionArguments(args, ""); //$NON-NLS-1$ return ex.getVMArgumentsArray(); }
for (int i = 0; i < properties.length; i++) { String property = properties[i]; String key = getSystemPropertyKey(property); String value = prefs.get(key, null); if (value != null) { if (file != null && file.exists()) { VMRunnerConfiguration config = new VMRunnerConfiguration("org.eclipse.jdt.internal.launching.support.LegacySystemProperties", new String[] { file.getAbsolutePath() });//$NON-NLS-1$ IVMRunner runner = getVMRunner(ILaunchManager.RUN_MODE); if (runner == null) { abort(NLS.bind(LaunchingMessages.AbstractVMInstall_0, ""), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$ IProcess[] processes = launch.getProcesses(); if (processes.length != 1) { abort(NLS.bind(LaunchingMessages.AbstractVMInstall_0, runner), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); abort(NLS.bind(LaunchingMessages.AbstractVMInstall_4, commandLine), e, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); } catch (IOException e) { String commandLine = process.getAttribute(IProcess.ATTR_CMDLINE); abort(NLS.bind(LaunchingMessages.AbstractVMInstall_4, commandLine), e, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); abort(NLS.bind(LaunchingMessages.AbstractVMInstall_0, commandLine), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); abort(NLS.bind(LaunchingMessages.AbstractVMInstall_0, file), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); String property = keys.next(); String value = map.get(property); String key = getSystemPropertyKey(property); prefs.put(key, value);
newLocations = getVMInstallType().getDefaultLibraryLocations(getInstallLocation()); prevLocations = getVMInstallType().getDefaultLibraryLocations(getInstallLocation());
((AbstractVMInstall)realVM).setNotify(notify); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next(); avm.setAttribute(entry.getKey(), entry.getValue()); avm.setNotify(true);
Map<String, String> attributes = ((AbstractVMInstall)vm).getAttributes(); if (!attributes.isEmpty()) { Element attrElement = doc.createElement("attributeMap"); //$NON-NLS-1$
for (int i = 0; i < properties.length; i++) { String property = properties[i]; String key = getSystemPropertyKey(property); String value = prefs.get(key, null); if (value != null) { if (file != null && file.exists()) { VMRunnerConfiguration config = new VMRunnerConfiguration("org.eclipse.jdt.internal.launching.support.LegacySystemProperties", new String[] { file.getAbsolutePath() });//$NON-NLS-1$ IVMRunner runner = getVMRunner(ILaunchManager.RUN_MODE); if (runner == null) { abort(NLS.bind(LaunchingMessages.AbstractVMInstall_0, ""), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$ IProcess[] processes = launch.getProcesses(); if (processes.length != 1) { abort(NLS.bind(LaunchingMessages.AbstractVMInstall_0, runner), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); abort(NLS.bind(LaunchingMessages.AbstractVMInstall_4, commandLine), e, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); } catch (IOException e) { String commandLine = process.getAttribute(IProcess.ATTR_CMDLINE); abort(NLS.bind(LaunchingMessages.AbstractVMInstall_4, commandLine), e, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); abort(NLS.bind(LaunchingMessages.AbstractVMInstall_0, commandLine), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); abort(NLS.bind(LaunchingMessages.AbstractVMInstall_0, file), null, IJavaLaunchConfigurationConstants.ERR_INTERNAL_ERROR); String property = keys.next(); String value = map.get(property); String key = getSystemPropertyKey(property); prefs.put(key, value);
newLocations = getVMInstallType().getDefaultLibraryLocations(getInstallLocation()); prevLocations = getVMInstallType().getDefaultLibraryLocations(getInstallLocation());
((AbstractVMInstall)realVM).setNotify(notify); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next(); avm.setAttribute(entry.getKey(), entry.getValue()); avm.setNotify(true);
Map<String, String> attributes = ((AbstractVMInstall)vm).getAttributes(); if (!attributes.isEmpty()) { Element attrElement = doc.createElement("attributeMap"); //$NON-NLS-1$
@Override public int hashCode() { return getVMInstallType().hashCode() + getId().hashCode(); }
/** * Compares the version of vm and a version of the Java platform. * * @param vm * IVMInstall to be compared * @param ver * version to be compared * @return the value {@code 0} if both versions are the same; a value less than {@code 0} if <code>vm</code> is smaller than <code>ver</code>; and * a value greater than {@code 0} if <code>vm</code> is higher than <code>ver</code>; a value {@code -1} in case of any exceptions; * * @since 3.10 */ public static int compareJavaVersions(IVMInstall vm, String ver) { if (vm instanceof AbstractVMInstall) { AbstractVMInstall install = (AbstractVMInstall) vm; String vmver = install.getJavaVersion(); if (vmver == null) { return -1; } // versionToJdkLevel only handles 3 char versions = 1.5, 1.6, 1.7, etc if (vmver.length() > 3) { vmver = vmver.substring(0, 3); } return JavaCore.compareJavaVersions(vmver, ver); } return -1; } /**
/** * Initializes the settings of this stand-in based on the settings in the given * VM install. * * @param realVM VM to copy settings from */ private void init(IVMInstall realVM) { setName(realVM.getName()); setInstallLocation(realVM.getInstallLocation()); setLibraryLocations(realVM.getLibraryLocations()); setJavadocLocation(realVM.getJavadocLocation()); if (realVM instanceof IVMInstall2) { IVMInstall2 vm2 = (IVMInstall2) realVM; setVMArgs(vm2.getVMArgs()); fJavaVersion = vm2.getJavaVersion(); } else { setVMArguments(realVM.getVMArguments()); fJavaVersion = null; } if (realVM instanceof AbstractVMInstall) { AbstractVMInstall vm2 = (AbstractVMInstall) realVM; Map<String, String> attributes = vm2.getAttributes(); Iterator<Entry<String, String>> iterator = attributes.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next(); setAttribute(entry.getKey(), entry.getValue()); } } }
@Override public String[] getVMArguments() { String args = getVMArgs(); if (args == null) { return null; } ExecutionArguments ex = new ExecutionArguments(args, ""); //$NON-NLS-1$ return ex.getVMArgumentsArray(); }
@Override public boolean equals(Object object) { if (object instanceof IVMInstall) { IVMInstall vm = (IVMInstall)object; return getVMInstallType().equals(vm.getVMInstallType()) && getId().equals(vm.getId()); } return false; }
/** * Examines the project and install for presence of module and execution support. * * @param config * runner configuration * @param vmInstall * VM install * @return <code>true</code> if project is a module and uses JRE version 9 or more, or <code>false</code> otherwise * @since 3.10 */ protected boolean isModular(VMRunnerConfiguration config, IVMInstall vmInstall) { if (config.getModuleDescription() != null && config.getModuleDescription().length() > 0 && vmInstall instanceof AbstractVMInstall) { AbstractVMInstall install = (AbstractVMInstall) vmInstall; String vmver = install.getJavaVersion(); // versionToJdkLevel only handles 3 char versions = 1.5, 1.6, 1.9, etc if (vmver.length() > 3) { vmver = vmver.substring(0, 3); } if (JavaCore.compareJavaVersions(vmver, JavaCore.VERSION_9) >= 0) { return true; } } return false; } }
/** * Initializes the settings of this stand-in based on the settings in the given * VM install. * * @param realVM VM to copy settings from */ private void init(IVMInstall realVM) { setName(realVM.getName()); setInstallLocation(realVM.getInstallLocation()); setLibraryLocations(realVM.getLibraryLocations()); setJavadocLocation(realVM.getJavadocLocation()); if (realVM instanceof IVMInstall2) { IVMInstall2 vm2 = (IVMInstall2) realVM; setVMArgs(vm2.getVMArgs()); fJavaVersion = vm2.getJavaVersion(); } else { setVMArguments(realVM.getVMArguments()); fJavaVersion = null; } if (realVM instanceof AbstractVMInstall) { AbstractVMInstall vm2 = (AbstractVMInstall) realVM; Map<String, String> attributes = vm2.getAttributes(); Iterator<Entry<String, String>> iterator = attributes.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next(); setAttribute(entry.getKey(), entry.getValue()); } } }
@Override public boolean equals(Object object) { if (object instanceof IVMInstall) { IVMInstall vm = (IVMInstall)object; return getVMInstallType().equals(vm.getVMInstallType()) && getId().equals(vm.getId()); } return false; }
IVMInstall vm1= JavaRuntime.getVMInstall(elem.getPath()); if (vm1 instanceof AbstractVMInstall) { v1= ((AbstractVMInstall) vm1).getJavaVersion(); v2= ((AbstractVMInstall) vm2).getJavaVersion();