Nashorn (
http://openjdk.java.net/projects/nashorn/
) is the JavaScript engine that was introduced in Java 8 to replace the old engine based on Mozilla Rhino. In Java 8 Nashorn was based on ECMAScript 5. Some new features of ECMAScript 6 have already been implemented in the Nashorn engine in Java 9. The Nashorn-related API is in the module jdk.scripting.nashorn.
Getting the Nashorn Engine
You can use the JSR 223 (
https://www.jcp.org/en/jsr/detail?id=223
) ScriptEngine to get the Nashorn engine; see Listing 11-1. The expression new ScriptEngineManager().getEngineByName("Nashorn") is the standard way to get an instance ...