title: Nashorn: Call function inside of a namespace
body: <p>I have evaluated the following script using the <code>NashornScriptEngine</code>:</p>
  
  <pre><code>var Namespace = {
      test: function()
      {
          return "It works";
      }
  }
  </code></pre>
  
  <p><strong>Now I want to call the function <code>test</code>.</strong></p>
  
  <p>When using the method <code>invokeFunction</code> of the nashorn engine, the following exception is thrown:</p>
  
  <pre><code>java.lang.NoSuchMethodException: No such function Namespace.test
  </code></pre>
  
  <p>How is it possible to call this function?</p>