I need to execute JS code in Java (JDK 18). To do this, I want to use the ScriptEngine class with the engine "Nashorn" (or any other capable of executing Javascript) using the constructor new ScriptEngineManager().getEngineByName("nashorn").
The problem is that this code returns null, the same happens for the name "js". Then I decided to go through the list of all possible engines with new ScriptEngineManager().getEngineFactories(), but it returns...an empty list. After a little digging, I also found out that Nashorn seems to have been removed from JDK15, so another question: what to use?