...
The Nashorn plugin provides support for the Nashorn JavaScript engine for IdPs of version 4.1 and beyond. This the scripting engine that was shipped with Java between versions 8 to 14 (it is not present as of JDK15). It is therefore targeted at IdP installations on JDK 15 and laterThe plugin uses the Nashorn scripting engine provided by the OpenJDK project.
Installation
Info |
---|
Starting with IdP 4.2 you can the install the latest plugin version supported on your IdP version with |
Configuration
This plugin requires no configuration and does not expose any Modules. Its sole purpose is to add a new scripting language to the IdP. The plugin is actually a JSR-223 implementation which works alongside the IdP to make these language strings available:
...
This is a collection point for any “generic” scripting tips or examples that don’t pertain to specific use cases but just illustrate harder or non-obvious ways to use Javascript in the Java environment.
Setting ‘nashorn.args’
The Nashorn scripting engine can be configured via the nashorn.args
system property - and on JDK11, an argument could have been passed to silence the Nashorn deprecation warning:
Code Block |
---|
-Dnashorn.args=--no-deprecation-warning |
The --no-deprecation-warning
argument is no longer accepted in nashorn.args
and causes Nashorn to fail to load (silently, see below).
Debugging issues with the Nashorn Scripting Engine
The engine can fail (and indeed fail to load) silently. To debug this (not your script itself) you can set the nashorn.debug
system property to “true” (-Dnashorn.debug=true
).
Accessing Classes or Static Methods
...