title: How to obtain a package version from the JAR's manifest, using the getImplementationVersion() method of the Package class
body: <p>When I prepare my program for deployment, I pack it into a JAR, along with the Eclipse jar-in-jar class loader. When my program runs from the JAR, I need to know a package's version, but I can not obtain it from the jar's manifest a simple and "honest" way. 
  The manifest looks like this:</p>
  
  <pre><code> Manifest-Version: 1.0
   Created-By: 1.8.0_73-b02 (Oracle Corporation)
   Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
   Rsrc-Main-Class: com.domain.sp2.controller.Controller
   Rsrc-Class-Path: ./ jar-in-jar-loader.zip javahelp-2.0.05.jar json-simple-1.1.1.jar
   Class-Path: .
  
   Name: com/domain/sp2/controller/
   Implementation-Version: 19
  </code></pre>
  
  <p>To obtain the package's implementation version, I try to use the simplest and straight-forward way:</p>
  
  <pre><code>package com.domain.sp2.controller;
  public class Controller {
  ...
     public static String getBuildNumber() throws IOException {
       Package pckg = Controller.class.getPackage();
       pr(pckg.getName());    // prints "com.domain.sp2.controller", as expected 
       return pckg.getImplementationVersion();   // returns null
     }  
  ...
  }
  </code></pre>
  
  <p>According to <a href="http://docs.oracle.com/javase/tutorial/deployment/jar/packageman.html" rel="noreferrer">http://docs.oracle.com/javase/tutorial/deployment/jar/packageman.html</a> and <a href="http://docs.oracle.com/javase/8/docs/api/java/lang/Package.html#getImplementationVersion--" rel="noreferrer">http://docs.oracle.com/javase/8/docs/api/java/lang/Package.html#getImplementationVersion--</a> (and other sources), it should return "19", but it returns null. For the packages of the JRE libraries, it returns correct values. Perhaps I have missed a detail about how to name the package in the manifest, or the reason pertains to the <code>JarRsrcLoader</code> - may be it requires some special syntax to address packages. I have also tried <code>".com/domain/..."</code>, <code>"/com/domain/..."</code> and <code>".../controller"</code>, and even <code>"rsrc:./com/domain..."</code> as the package name in the manifest - all without success.  I could use other ways, e.g. to load the manifest as stream and parse it with the Manifest class, yet I would like to understand what is the correct way to use the <code>getImplementationVersion()</code> method.</p>