Nashorn used to be bundled with Java between versions 8 to 14. It no longer ships starting with Java 15 and needs to be downloaded as a seperate JAR via OpenJDK.
https://github.com/openjdk/nashorn
Migrating to the OpenJDK version of Nashorn is pretty straightforward.
//Scripting includes
import javax.script.*;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
//Get Scripting Engine
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("nashorn");
//Scripting includes
import javax.script.*;
import org.openjdk.nashorn.api.scripting.ScriptObjectMirror;
import org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory;
import org.openjdk.nashorn.api.scripting.NashornScriptEngine;
//Get Scripting Engine
String[] options = new String[] { "--language=es6" };
NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
NashornScriptEngine engine = (NashornScriptEngine) factory.getScriptEngine(options);
At the time of this writing, the most current OpenJDK version of Nashorn is 15.4 and has the following dependencies: