On Feb 14, 7:31 pm, Norris Boyd <[EMAIL PROTECTED]> wrote:
> On Feb 14, 5:23 pm, [EMAIL PROTECTED] wrote:
>
snip
>
> > 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: 
> Seehttp://developer.mozilla.org/en/docs/New_in_Rhino_1.7R1#Common_packag...
>
> --N

I was able to import the package as you indicated.

When I attempt to call a method on the class in the package (as in
foo.bar() ) I receive a reference error that the class (foo) is
undefined.  When I attempt to fully qualify the call as
Packages.com.doodaa.foo.bar() I receive a TypeError bar is not a
function, it is org.mozilla.javascript.NativeJavaPackage.  It seems
that the importPackage has not bought me anything and I have not
figured out how to properly reference the class for it to be imported
using importClass;

Also to make things interesting, the package, class and method are
being passed to me as strings so I'm executing these with eval() in my
code.  Testing is also failing using the js.jar command interpreter
though.

Thanks again
Chad
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to