title: How can I access a static-method only class via ScriptEngine?
body: <p>I have a class <code>Foo</code> that has only one static method (of note), called <code>bar()</code>. I need to access <code>bar()</code> via a runtime script (in this case Javascript).</p>
  
  <pre><code>final ScriptEngineManager factory;
  factory = new ScriptEngineManager();
  
  factory.put("foo", new Foo());
  </code></pre>
  
  <p>The above works, but it seems a bit odd to me. Specifically I don't want to create a new Foo. <code>Foo</code> is public, so there must be a way to let the script factory know about it, without instantiating a new object. I have tried <code>factory.put("foo", Foo.class);</code> but that didn't work. I also tried specifying the package in the Javascript code, eg.</p>
  
  <pre><code>package.Foo.bar();
  </code></pre>
  
  <p>but that didn't work either.</p>
  
  <p><strong>Q:</strong> Is there a way to access a class' static methods from an embedded script, without binding an instance of that class to the engine?</p>