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).  The plugin uses the Nashorn scripting engine provided by the OpenJDK project.


Starting with IdP 4.2 you can the install the latest plugin version supported on your IdP version with
.\ -I net.shibboleth.idp.plugin.nashorn





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:

  • nashorn

  • Nashorn

  • js

  • JS

  • JavaScript

  • javascript

  • ECMAScript

  • ecmascript


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:


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

Many of the APIs in our software rely on class objects or static methods, which are simple to use in Java itself but less obvious in Javascript.

Calling a static method on a class looks like this. The method name in this example is bar and it takes no arguments.

var type = Java.type("org.example.package.ClassName"); var foo =;

Accessing a class object is slightly different:

var claz = Java.type("org.example.package.ClassName").class; var classname = claz.getName();