On Feb 14, 5:23 pm, [EMAIL PROTECTED] wrote: > I've searched and can't really find any documentation on using > importPackage() or importClass() from an ecmascript to access an > arbitrary class, preferably stored in a jar. I'm testing with js.jar > from rhino1_6R7. > > executing command similar to importPackage(com.foo.bar); returns an > error that "com" is not defined. The same error occurs with the > actual package name. Using the command importClass(SimpleDataBlock); > returns an error that SimpleDataBlock is not defined. > > Any pointers? > > Thanks > Chad
With all released versions of Rhino you must prefix the package name with "Packages." for every package name other than those that start with java. For example: js> importPackage(Packages.org.mozilla.javascript) js> Context.enter() [EMAIL PROTECTED] Starting with Rhino 1.7R1, common package names will be preloaded so you won't need "Packages" except for unusual or default package classes: See http://developer.mozilla.org/en/docs/New_in_Rhino_1.7R1#Common_package_names_preloaded --N _______________________________________________ dev-tech-js-engine-rhino mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino
