title: calling javaScript from java method
body: <p>I want to execute JavaScript function from Java. I used the following piece of code</p>
  
  <pre><code>ScriptEngineManager manager = new ScriptEngineManager();    
  ScriptEngine engine = manager.getEngineByName("JavaScript"); 
  </code></pre>
  
  <p>but this throws an exception for the <code>alert()</code> method ?</p>
  
  <pre><code>engine.eval("alert('HI');");
  </code></pre>