/** * Display package name and version information for javax.mail.internet. * * <p>This example is a bit artificial, since examining the version of a jar from Sun Microsystems * is unusual. * * @return _more_ * @throws IOException _more_ */ private static HashMap<String, String> getBuildInfo() throws IOException { GribVariableRenamer renamer = new GribVariableRenamer(); HashMap<String, String> buildInfo = new HashMap<String, String>(); Enumeration<URL> resources = renamer.getClass().getClassLoader().getResources("META-INF/MANIFEST.MF"); while (resources.hasMoreElements()) { try { Manifest manifest = new Manifest(resources.nextElement().openStream()); Attributes attrs = manifest.getMainAttributes(); if (attrs != null) { String implTitle = attrs.getValue("Implementation-Title"); if ((implTitle != null) && (implTitle.contains("ncIdv"))) { buildInfo.put("version", attrs.getValue("Implementation-Version")); String strDate = attrs.getValue("Built-On"); CalendarDate cd = CalendarDate.parseISOformat(null, strDate); buildInfo.put("buildDate", cd.toString()); break; } } } catch (IOException e) { e.printStackTrace(); } } return buildInfo; }