Depending on com.sun.javadoc from tools.jar (Sun JDK) in Eclipse

后端 未结 1 1920
温柔的废话
温柔的废话 2020-12-11 18:12

One of our plugins requires an installed JDK, not just an JRE. We need com.sun.javadoc and friends from tools.jar. I do not think Sun\'s license will allow redistributing to

相关标签:
1条回答
  • 2020-12-11 19:03

    Since eclipse offers an OSGi environment, you could refer to the article "Exposing the boot classpath in OSGi", and try using:

    • a System Packages declaration
    • a Extension Bundles (Fragment) declaration
    • or boot delegation

    By specifying the JDK packages you need, the OSGI framework will attempt to load them (and fail if there are not here).
    By specifying one specific to JDK5 or JDK6, you could even ensure the right version of the JDK.

    The OSGi spec allows the Framework (through its system bundle) to export any relevant packages from its parent class loader as system packages using the org.osgi.framework.system.packages property.
    As repacking the hosting JDK as a bundle isn't a viable option, one can use this setting to have the system bundle (or the bundle with id 0) export these packages itself.
    Most of the OSGi implementations already use this property to export all the public JDK packages (based on the detected JDK version). Below is a snippet from an Equinox configuration file for Java 1.6:

    org.osgi.framework.system.packages = \
      javax.accessibility,\
      javax.activity,\
      javax.crypto,\
      javax.crypto.interfaces,\
      …
      org.xml.sax.helpers
    

    Using this property, one can add extra packages that will be loaded and provided by the framework and that can be wired to other bundles.

    org.osgi.framework.system.packages = \
      javax.accessibility,\
      javax.activity,\
      …
      org.xml.sax.helpers, \
      special.parent.package
    

    Note: the simpler solution of specifying Bundle-RequiredExecutionEnvironment is only for the JRE, not the JDK...


    That kind of configuration need to be part of the config.ini of the Equinox framework (see this example for Jetty and its config.ini).
    In your case, it would be declared in the config.ini of your fragment.

    0 讨论(0)
提交回复
热议问题