title: Nashorn. Binding native Java objects?
body: <p>I'd like to put native Java objects into the ScriptEngine bindings for easier access.<br>
  I mean to avoid lots of Java.type(...).<br>
  I tried in that way.</p>
  
  <pre><code>jsEngine.getContext().getBindings(ScriptContext.ENGINE_SCOPE).put("manager", Manager.getInstance());
  </code></pre>
  
  <p>But that's failed with error <em>"Manager has no such function "funcName" in eval...".</em></p>
  
  <p>Is it possible at all?</p>
  
  <p><strong>UPD:</strong><br>
  Example code<br></p>
  
  <pre><code>public class ManagerClass {
  
      public void test()
      {
          System.out.println("Hello");
      }
  
      public static void test2()
      {
          System.out.println("Hello Static");
      }
  }
  
  public class NewClass {
      public static void main(String[] args) throws ScriptException {
          final ScriptEngine s = new ScriptEngineManager().getEngineByExtension("js");
          s.getBindings(ScriptContext.ENGINE_SCOPE).put("manager", new ManagerClass());
          s.eval("manager.test(); manager.test2();");
      }
  }
  </code></pre>