title: How to access the internal sun.security class from an OSGI bundle?
body: <p>What options do I need to add to the maven build or the java runtime to access the internal sun.security classes? There is Java code from Akamai in an OSGI bundle needs access to internal sun.security classes. The Apache Felix console gives errors for the OSGI bundle:</p>
  
  <pre><code>sun.awt.image.codec -- Cannot be resolved
  sun.io -- Cannot be resolved
  sun.misc -- Cannot be resolved
  sun.rmi.rmic -- Cannot be resolved
  sun.security.action -- Cannot be resolved
  sun.security.ec -- Cannot be resolved
  sun.security.internal.interfaces -- Cannot be resolved
  ...
  </code></pre>
  
  <p>I looked at <a href="https://stackoverflow.com/questions/4065401/using-internal-sun-classes-with-javac">this article about using internal sun classes</a> but it only refers to javac. My maven build starts like:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd "&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;artifactId&gt;cdncache&lt;/artifactId&gt;
    &lt;packaging&gt;bundle&lt;/packaging&gt;
    &lt;name&gt;NCDN Cache&lt;/name&gt;
    &lt;description&gt;Classes and interfaces to expire resource from the Akamai CDN cache [build:${build.number}]\
  &lt;/description&gt;
    &lt;version&gt;1.0-${build.number}&lt;/version&gt;
    &lt;properties&gt;
      &lt;!-- Skip tests, so maven execution is faster. --&gt;
      &lt;maven.test.skip&gt;true&lt;/maven.test.skip&gt;
      &lt;file.encoding&gt;utf-8&lt;/file.encoding&gt;
    &lt;/properties&gt;
    &lt;build&gt;
      &lt;plugins&gt;
      &lt;groupId&gt;org.apache.felix&lt;/groupId&gt;
      &lt;artifactId&gt;maven-bundle-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.0.1&lt;/version&gt;
      &lt;extensions&gt;true&lt;/extensions&gt;
      &lt;configuration&gt;
        &lt;instructions&gt;
          &lt;Export-Package&gt;
            com.nymag.akamai,
            com.akamai.*,
            ...
          &lt;/Export-Package&gt;
          &lt;Private-Package&gt;
            org.apache.axis.*,
            ...
            sun.security,
            sun.security.ec,
          &lt;/Private-Package&gt;
          &lt;Bundle-Version&gt;1.0&lt;/Bundle-Version&gt;
          &lt;Bundle-Activator&gt;com.nymag.akamai.Activator&lt;/Bundle-Activator&gt;
        &lt;/instructions&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
    ...
  </code></pre>