'Java returns cannont invoke ScriptEngine error
I am running Java's ScriptEngine class to run to some code. I use IntelliJ with maven dependencies when I run the code it says
Cannot invoke "javax.script.ScriptEngine.eval(String)" because "this.engine" is null
at Run.Evaluater.<init>(Evaluater.java:19)
the code at line being the following
engine.put("event", event);
engine.put("content", message);
This is how I initiated the ScriptEngone
public ScriptEngineManager man = new ScriptEngineManager();
public ScriptEngine engine = man.getEngineByName("nashorn");
Solution 1:[1]
This error was encountered when a project was cloned from the code cloud when it was running. This part of the content is about the loading of the verification code. I did not understand the reason but it was a version problem. Change the JDK version from The problem is solved when 13 is reduced to 8.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gayan Chinthaka |