title: OSGi: Recalculate the Import-Package of a JAR programmatically
body: <p>I want to recalculate the &quot;Import-Package&quot; of an OSGi Jar programmatically. I try to use the bnd Analyser.</p>
  <pre><code>    try(Analyzer analyzer = new Analyzer()) {
          analyzer.setJar(new File(filename));
          return analyzer.getImportPackage();
      }
  </code></pre>
  <p>This returns the (wrong) existent imports of the MANIFEST.MF. How can I recalculate the &quot;Import-Package&quot; of an OSGi Jar programmatically?</p>
  <p><strong>Update</strong>
  Adding as BJ Hargrave calMainfest() suggested does not work:</p>
  <pre><code>try(Analyzer analyzer = new Analyzer()) {
      analyzer.setJar(new File(filename));
      analyzer.calcManifest(); 
      return analyzer.getImportPackage();
  }
  </code></pre>
  <p>It seems to use the existing MANIFEST.MF contained in the Jar.
  Best regards
  Kisho</p>