Tom Schindl is probably the best person
to ask since he did the work to get javafx working. I remember we
went through a number of options before he landed on an acceptable solution.
I'm pretty sure the solution involved some equinox specific hook
to grant access to the stuff on the extension class loader.
If I was implementing this today I probably
would start with a 2 part solution.
1) Provide a 'shell' of a bundle that
only contains a bundle manifest that exports the nashorn API a packages.
This bundle does not actually contain nashorn implementation, it
is just used to virtualize the exported packages so that other bundles
can use Import-Package to access them. This bundle would also use
a Require-Capability requirement that would require the functionality provided
in part 2
2) Provide an equinox specific system.bundle
fragment (using Fragment-Host against the Equinox BSN org.eclipse.osgi)
and this extension would provide an implementation of the hook method org.eclipse.osgi.internal.hookregistry.ClassLoaderHook.createClassLoader(ClassLoader,
EquinoxConfiguration, BundleLoader, Generation), but it would only return
a non-null class loader for the 'shell' bundle from part 1. I would
probably also mark the 'shell' bundles from part 1 with a capability so
you can easily identify them without hard coding the BSN of the 'shell'
bundle here. The class loader you return would use the extension
class loader where nashorn is located as its parent classloader so it can
load classes from it. This fragment would also use Provide-Capability
using some namespace you invent such that it can be required by the bundle
in part 1.
This way when other bundles import-package
for nashorn packages they will get wired to the 'shell' bundle but the
ultimate class load would get delegated to the class loader you return
from part 2.
03/10/2016 09:50 AM Subject:
Directive for ExtensionClasspath Sent by:
Hi, While looking for a solution for using Nashorn which lives on the extension classpath from Eclipse IDE, I was pointed to an old thread. The thread discusses about Equinox-specific manifest directives that would allow a Fragment to use extension classpath. However, I have been researching and also looked through the equinox code and could not
find any reference that this discussion has materialized. Can someone confirm my conclusion? I also welcome any ideas on how to solve the extension classpath problem if that is the case.