Looks like that might be a Rhino-specific solution - I was hoping that the scripting API supported a means for pre-populating the import scope in a language-independent way (i.e., via a hypothetical javax.script.NativeJavaPackage class). Also, it looks like NativeJavaPackage is only for internal use:
http://stderr.org/doc/rhino-doc/apidocs/org/mozilla/javascript/NativeJavaPackage.html Useful information nonetheless. Thanks! On Jun 16, 11:58 am, Charles Lowell <[email protected]> wrote: > I don't know who told you that, but you can preload your scope with > anything you want using java or javascript: > > //haven't checked this to make sure it compiles. > Scriptable scope = cx.initStandardObjects(); > cx.evaluateString(scope, "mypackage = > Packages.com.mydomain.myproject.mypackage;", "<preloader>", 1, null); > > //alternatively > > scope.put("mypackage", new NativeJavaPackage > ("com.mydomain.myproject.mypackage"), scope); _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
