The great benefit from this approach is that applications can be extended through scripting without using any Rhino or otherwise scripting specific APIs. The hosting application just uses the java.lang.ClassLoader and java.lang.Class API to get classes and instances as if it was dealing with ordinary Java classes.
Class name to Script lookup follows a very simple resolution mechanism where class "foo.Bar" is resolved to path "foo/Bar.js". Subclassing other Java class or implementing Java interfaces is also straightforward. Just include something like this in your script:
this.__extends__ = "my.package.SomeClass"; this.__implements__ = ["my.package.SomeInterface", ...];
A simple example is contained in the demo folder. To run it, just run ant target "demo":
You can get RhinoLoader from the Subversion repository at http://dev.helma.org/svn/helma/branches/rhinoloader/, browse the code or download it here: