title: Calling Java function from Rhino
body: <p>Calling Javascript functions running inside Rhino from Java is easy enough - that after all is why Rhino was created.  The thing I am having trouble establishing is this:</p>
  
  <ul>
  <li><strong>Context</strong>: I have a Phonegap CLI (v 6.3.3) Android project (API 19+) where I do a great deal of processing via loadable JavaScript running inside rhino</li>
  <li>A Phonegap plugin - which I am creating at the same time as the actual Phonegap app - contains class called <code>Storage</code> which provides public, static, methods such as <code>readFromFile(String fileName)</code>, <code>writeToFile(String fileName,String data)</code> etc.</li>
  <li>What I want to be able to do is to call <code>Storage.readFromFile</code> etc from my loaded JavaScript code in Rhino.</li>
  </ul>
  
  <p>Just how this should be done is not too clear to me.  From the searches I have done thus far it involves using <code>ScriptableObject.putProperty</code> to pass the Java class in question, <code>Storage</code> in my case to JavaScript.  However, how this should be done and then how it should be used at the JS end leaves me rather confused.</p>
  
  <p>I would be most grateful to anyone here who might be able to point me in the right direction </p>