/** * 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; }
allLibs = new ArrayList<LibraryLocation>(gatherAllLibraries(libInfo.getEndorsedDirs())); String[] bootpath = libInfo.getBootpath(); List<LibraryLocation> boot = new ArrayList<LibraryLocation>(bootpath.length); URL url = getDefaultJavadocLocation(installLocation); allLibs.addAll(gatherAllLibraries(libInfo.getExtensionDirs()));
String[] extDirs = parsePaths(extDirPaths); String[] endDirs = parsePaths(endorsedDirsPath); return new LibraryInfo(version, bootPath, extDirs, endDirs);
/** * 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(); }
String[] extensionDirsArray = libraryInfo.getExtensionDirs(); Set<String> extensionDirsSet = new HashSet<>(); for (int i = 0; i < extensionDirsArray.length; i++) {
allLibs = new ArrayList<>(gatherAllLibraries(libInfo.getEndorsedDirs())); URL url = getDefaultJavadocLocation(installLocation); if (libInfo.getBootpath().length == 0) { String[] bootpath = libInfo.getBootpath(); List<LibraryLocation> boot = new ArrayList<>(bootpath.length); allLibs.addAll(gatherAllLibraries(libInfo.getExtensionDirs()));
String[] extDirs = parsePaths(extDirPaths); String[] endDirs = parsePaths(endorsedDirsPath); return new LibraryInfo(version, bootPath, extDirs, endDirs);
/** * 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(); }
String[] extensionDirsArray = libraryInfo.getExtensionDirs(); Set<String> extensionDirsSet = new HashSet<String>(); for (int i = 0; i < extensionDirsArray.length; i++) {
/** * 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; }
String[] endDirs = getPathsFromXML(element, "endorsedDirs"); //$NON-NLS-1$ if (location != null) { LibraryInfo info = new LibraryInfo(version, bootpath, extDirs, endDirs); fgLibraryInfoMap.put(location, info);
/** * 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; } }
LaunchingPlugin.log(LaunchingMessages.VMLogging_1 + location); LibraryInfo info = new LibraryInfo(version, bootpath, extDirs, endDirs); fgLibraryInfoMap.put(location, info);
/** * 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 default library information for the given install location. * * @param installLocation the VM install location * @return LibraryInfo */ protected LibraryInfo getDefaultLibraryInfo(File installLocation) { IPath rtjar = getDefaultSystemLibrary(installLocation); File extDir = getDefaultExtensionDirectory(installLocation); File endDir = getDefaultEndorsedDirectory(installLocation); String[] dirs = null; if (extDir == null) { dirs = new String[0]; } else { dirs = new String[] {extDir.getAbsolutePath()}; } String[] endDirs = null; if (endDir == null) { endDirs = new String[0]; } else { endDirs = new String[] {endDir.getAbsolutePath()}; } return new LibraryInfo("???", new String[] {rtjar.toOSString()}, dirs, endDirs); //$NON-NLS-1$ }
@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; }
/** * Returns default library information for the given install location. * * @param installLocation the VM install location * @return LibraryInfo */ protected LibraryInfo getDefaultLibraryInfo(File installLocation) { IPath rtjar = getDefaultSystemLibrary(installLocation); File extDir = getDefaultExtensionDirectory(installLocation); File endDir = getDefaultEndorsedDirectory(installLocation); String[] dirs = null; if (extDir == null) { dirs = new String[0]; } else { dirs = new String[] {extDir.getAbsolutePath()}; } String[] endDirs = null; if (endDir == null) { endDirs = new String[0]; } else { endDirs = new String[] {endDir.getAbsolutePath()}; } return new LibraryInfo("???", new String[] {rtjar.toOSString()}, dirs, endDirs); //$NON-NLS-1$ }
@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; }
return new LibraryInfo("1.1.x", new String[] {classesZip.toOSString()}, new String[0], new String[0]); //$NON-NLS-1$
return new LibraryInfo("1.1.x", new String[] {classesZip.toOSString()}, new String[0], new String[0]); //$NON-NLS-1$