title: Why does getEngineByName(“js”) return null?
body: <p>Whatever I try, <code>getEngineByName()</code> keeps returning null.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>final ScriptEngineManager manager = new ScriptEngineManager();
  final ScriptEngine engine = manager.getEngineByName("js");
  </code></pre>
  
  <p>But <code>engine</code> is null after these lines.</p>
  
  <p>I also tried:</p>
  
  <ul>
  <li><code>getEngineByName("javascript")</code></li>
  <li><code>getEngineByName("nashorn")</code></li>
  </ul>
  
  <p>They all return <code>null</code>. Actually, <code>manager.getEngineFactories()</code> shows an empty array - meaning there are no Factories at all.</p>
  
  <p>These 2 answers suggest passing <code>null</code> to the constructor, but it didn't work for me:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/a/25332851/900394">https://stackoverflow.com/a/25332851/900394</a></li>
  <li><a href="https://stackoverflow.com/a/25332851/900394">https://stackoverflow.com/a/25332851/900394</a></li>
  </ul>
  
  <p>And <a href="https://stackoverflow.com/questions/10054252/trying-to-use-rhino-getenginebynamejavascript-returns-null-in-openjdk-7">this answer</a> says it's a bug that <strong>has been fixed</strong>.</p>
  
  <hr>
  
  <p><strong>Update:</strong></p>
  
  <p>That was an <strong>Android Application Project</strong> in eclipse.</p>
  
  <p>I didn't know it differs that much from a <strong>Java Project</strong>.</p>
  
  <p>Now I just opened a new <strong>Java Project</strong>, wrote these lines, and I'm getting some results:</p>
  
  <pre><code>import javax.script.ScriptEngine;
  import javax.script.ScriptEngineManager;
  import javax.script.ScriptException;
  import javax.script.SimpleBindings;
  
  public class TestClass {
  
      public static void main(String[] args) throws ScriptException {
          ScriptEngineManager manager = new ScriptEngineManager();
          ScriptEngine engine = scriptEngineManager.getEngineByName("js");
      }
  }
  </code></pre>
  
  <p><code>engine</code> isn't <strong>null</strong> !</p>
  
  <p>Also, <code>javax.script.*</code> was imported successfully as if it's already there (built in). Is this because I'm using Java 8?</p>
  
  <p>In that previous (android) project I was using <strong>javax.script</strong> downloaded from <a href="https://code.google.com/p/jav8/" rel="nofollow noreferrer">here</a>.</p>
  
  <p>So what would be the problem in the <strong>Android Project</strong> and how do I solve it?</p>