/** * Returns the version of the VM at the given location, with the given * executable. * * @param javaHome the Java home folder * @param javaExecutable the Java executable file * @return String */ protected String getVMVersion(File javaHome, File javaExecutable) { LibraryInfo info = getLibraryInfo(javaHome, javaExecutable); return info.getVersion(); }
/** * Returns the version of the VM at the given location, with the given * executable. * * @param javaHome the Java home folder * @param javaExecutable the Java executable file * @return String */ protected String getVMVersion(File javaHome, File javaExecutable) { LibraryInfo info = getLibraryInfo(javaHome, javaExecutable); return info.getVersion(); }
/** * 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; } }
@Override public URL getDefaultJavadocLocation(File installLocation) { File javaExecutable = findJavaExecutable(installLocation); if (javaExecutable != null) { LibraryInfo libInfo = getLibraryInfo(installLocation, javaExecutable); if (libInfo != null) { String version = libInfo.getVersion(); return getDefaultJavadocLocation(version); } } return null; }
@Override public URL getDefaultJavadocLocation(File installLocation) { File javaExecutable = findJavaExecutable(installLocation); if (javaExecutable != null) { LibraryInfo libInfo = getLibraryInfo(installLocation, javaExecutable); if (libInfo != null) { String version = libInfo.getVersion(); return getDefaultJavadocLocation(version); } } return null; }
/** * Creates an XML element for the given info. * * @param doc the backing {@link Document} * @param info the {@link LibraryInfo} to add to the {@link Document} * @return Element */ private static Element infoAsElement(Document doc, LibraryInfo info) { Element libraryElement = doc.createElement("libraryInfo"); //$NON-NLS-1$ libraryElement.setAttribute("version", info.getVersion()); //$NON-NLS-1$ appendPathElements(doc, "bootpath", libraryElement, info.getBootpath()); //$NON-NLS-1$ appendPathElements(doc, "extensionDirs", libraryElement, info.getExtensionDirs()); //$NON-NLS-1$ appendPathElements(doc, "endorsedDirs", libraryElement, info.getEndorsedDirs()); //$NON-NLS-1$ return libraryElement; }
/** * Creates an XML element for the given info. * * @param doc the backing {@link Document} * @param info the {@link LibraryInfo} to add to the {@link Document} * @return Element */ private static Element infoAsElement(Document doc, LibraryInfo info) { Element libraryElement = doc.createElement("libraryInfo"); //$NON-NLS-1$ libraryElement.setAttribute("version", info.getVersion()); //$NON-NLS-1$ appendPathElements(doc, "bootpath", libraryElement, info.getBootpath()); //$NON-NLS-1$ appendPathElements(doc, "extensionDirs", libraryElement, info.getExtensionDirs()); //$NON-NLS-1$ appendPathElements(doc, "endorsedDirs", libraryElement, info.getEndorsedDirs()); //$NON-NLS-1$ return libraryElement; }