/** * Returns the version of the current VM in use * @return the VM version */ private double getJavaVersion() { String version = null; if (fVMInstance instanceof IVMInstall2) { version = ((IVMInstall2)fVMInstance).getJavaVersion(); } else { LibraryInfo libInfo = LaunchingPlugin.getLibraryInfo(fVMInstance.getInstallLocation().getAbsolutePath()); if (libInfo == null) { return 0D; } version = libInfo.getVersion(); } if (version == null) { // unknown version return 0D; } int index = version.indexOf("."); //$NON-NLS-1$ int nextIndex = version.indexOf(".", index+1); //$NON-NLS-1$ try { if (index > 0 && nextIndex>index) { return Double.parseDouble(version.substring(0,nextIndex)); } return Double.parseDouble(version); } catch (NumberFormatException e) { return 0D; } }
/** * Returns the version of the current VM in use * @return the VM version */ private double getJavaVersion() { String version = null; if (fVMInstance instanceof IVMInstall2) { version = ((IVMInstall2)fVMInstance).getJavaVersion(); } else { LibraryInfo libInfo = LaunchingPlugin.getLibraryInfo(fVMInstance.getInstallLocation().getAbsolutePath()); if (libInfo == null) { return 0D; } version = libInfo.getVersion(); } if (version == null) { // unknown version return 0D; } int index = version.indexOf("."); //$NON-NLS-1$ int nextIndex = version.indexOf(".", index+1); //$NON-NLS-1$ try { if (index > 0 && nextIndex>index) { return Double.parseDouble(version.substring(0,nextIndex)); } return Double.parseDouble(version); } catch (NumberFormatException e) { return 0D; } }
/** * Return library information corresponding to the specified install * location. If the information does not exist, create it using the given Java * executable. * @param javaHome the Java home folder * @param javaExecutable the Java executable file * @return the {@link LibraryInfo} for the home and executable path or an empty object, never <code>null</code> */ protected synchronized LibraryInfo getLibraryInfo(File javaHome, File javaExecutable) { String installPath = javaHome.getAbsolutePath(); LibraryInfo info = LaunchingPlugin.getLibraryInfo(installPath); if (info == null || LaunchingPlugin.timeStampChanged(installPath)) { info = fgFailedInstallPath.get(installPath); if (info == null) { info = generateLibraryInfo(javaHome, javaExecutable); if (info == null) { info = getDefaultLibraryInfo(javaHome); fgFailedInstallPath.put(installPath, info); } else { // only persist if we were able to generate information - see bug 70011 LaunchingPlugin.setLibraryInfo(installPath, info); } } } return info; }
File vmInstallLocation= vm.getInstallLocation(); if (vmInstallLocation != null) { LibraryInfo libraryInfo= LaunchingPlugin.getLibraryInfo(vmInstallLocation.getAbsolutePath()); if (libraryInfo != null) {
File vmInstallLocation= vm.getInstallLocation(); if (vmInstallLocation != null) { LibraryInfo libraryInfo= LaunchingPlugin.getLibraryInfo(vmInstallLocation.getAbsolutePath()); if (libraryInfo != null) {
LibraryInfo info = LaunchingPlugin.getLibraryInfo(installPath); if (info == null || LaunchingPlugin.timeStampChanged(installPath)) { info = fgFailedInstallPath.get(installPath);