title: Java returns cannont invoke ScriptEngine error
body: <p>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</p>
  <pre><code>Cannot invoke &quot;javax.script.ScriptEngine.eval(String)&quot; because &quot;this.engine&quot; is null
      at Run.Evaluater.&lt;init&gt;(Evaluater.java:19)
  </code></pre>
  <p>the code at line being the following</p>
  <pre><code>engine.put(&quot;event&quot;, event);
  engine.put(&quot;content&quot;, message);
  </code></pre>
  <p>This is how I initiated the ScriptEngone</p>
  <pre><code>    public ScriptEngineManager man = new ScriptEngineManager();
      public ScriptEngine engine = man.getEngineByName(&quot;nashorn&quot;);
  </code></pre>