You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2008/06/11 12:19:26 UTC

How to provide com.sun.tools.javac to a bundle?

Hi,

The Scala engine that Janandith is working on seems to require the
com.sun.tools.javac package, and I'm not sure how to make it
available.

Currently, the bundle [1] fails to load with an "Unresolved package in
bundle: package=com.sun.tools.javac" error.

I tried this in sling.properties but that did not help:

  sling.bootdelegation.class.java.lang.String=com.sun.tools.javac

Although that would only be a short-term workaround, does anyone have
a better suggestion?

-Bertrand

[1]  http://sling-scala.googlecode.com/svn/trunk/sling-scala, revision 23

Re: How to provide com.sun.tools.javac to a bundle?

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Am Mittwoch, den 11.06.2008, 12:19 +0200 schrieb Bertrand Delacretaz:
> Hi,
> 
> The Scala engine that Janandith is working on seems to require the
> com.sun.tools.javac package, and I'm not sure how to make it
> available.
> 
> Currently, the bundle [1] fails to load with an "Unresolved package in
> bundle: package=com.sun.tools.javac" error.

This package is part of the JDK tools.jar file and is not contained in
the JRE. If you really, really need this package, you may bundle a JDK
1.5 jar file with the scala bunde just like the scala libraries.

You may also - if not sure whether it is really required - just specify
an optional import for this package:

    <Import-Package>
       com.sun.*;resolution:=optional
    </Import-Package>

Then the bundle will resolve regardless of whether any required com.sun
package is available or not.

> I tried this in sling.properties but that did not help:
> 
>   sling.bootdelegation.class.java.lang.String=com.sun.tools.javac

This does not help, because the Import-Package declaration of
com.sun.tools.javac requires a bundle to export that package. This is
not the case with the sling.bootdelegation setting. You might want to
have the system bundle export that package by using

    sling.system.packages.class.java.lang.String=com.sun.tools.javac

> 
> Although that would only be a short-term workaround, does anyone have
> a better suggestion?

See above ;-)

But, then we should really look into whether com.sun.tools.javac is
really required ... So my first approach (optional resolution and no
system.packages) would be interesting to see.

Regards
Felix