Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

JSDT/Equinox hook for Nashorn

< JSDT
Revision as of 04:09, 4 April 2016 by Psuzzi.gmail.com (Talk | contribs) (Added initial description of Nashorn Hook)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Nashorn is a Javascript runtime library, available from Java 8+ in the <java-home>/lib/ext folder.

Eclipse plug-ins are OSGi bundles which, by default, are using the "boot class loader", which excludes the lib/ext

As JSDT.core is using Nashorn, the JSDT team elaborated a way to load this external lib.

Hooking Nashorn in different stages

At runtime: we have the org.eclipse.wst.jsdt.nashorn.extension plug-in fragment, which contains a class extending ClassLoaderHook, which give the option to extend the bundle classpath by adding the lib/ext folder.

To activate the ClassLoaderHook you need to add the following param to t he launch configuration:

-Dosgi.framework.extensions=org.eclipse.wst.jsdt.nashorn.extension

Practically: you will need to add the parameter to your running configuration or to your product configuration to have it working at a runtime.

In testing at development time, and in local Tycho build: you will need to specify a parameter to tell the Equinox classloader to load the normal Java extension classloader to load the normal Java extension classloader.

For this you will need to use the following param:

-Dorg.osgi.framework.bundle.parent=ext

Practically you will need to add the param to your test configuration, and in your tycho configuration. As an example check the webtools.jsdt\tests\pom.xml, where you can see the argline passes to maven:

<argLine>-Dorg.osgi.framework.bundle.parent=ext</argLine>

See also

Back to the top