Nashorn alternative for Java 11 [closed]

Tags: , , , ,



I am using Nashorn JavaScript Engine in Java 11 which works fine except it will be deprecated soon. I have tried GraalVM which I find quite worse as it takes 13-14 seconds to execute a simple expression (e.g. 2+3). Is there any other alternative that I could use or should I try GraalVM with some other approach (if there is any)?

ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName("javascript");
engine.eval("2+3");

Answer

You can use Rhino as replacement

Rhino still is being maintained as an open-source project and so has a history of community involvement. For some uses, it’s clearly superior because of its faster startup time.



Source: stackoverflow