title: Rhino: How to return a string from Java to Javascript?
body: <p>How do I use Rhino return a string from Java to Javascript, all I get is <code>org.mozilla.javascript.JavaNativeObject</code> when I use</p>
  
  <pre><code>var jsString = new java.lang.String("test");
  </code></pre>
  
  <p>inside my js file.</p>
  
  <p>Is this the right way to do it?</p>
  
  <pre><code>var jsString = String(new java.lang.String("test"));
  </code></pre>
  
  <p>The goal is to have a Java method to return the String object instead of creating it on the fly like above.</p>