On Feb 18, 10:53 am, [EMAIL PROTECTED] wrote:
> Hello
>
> I've created a simple proof of concept java class that I wish to call
> from javascript:
>
> package com.foo.bar;
>
> public class doodaa {
>     public static String method1 (String theString) {
>         return theString;
>
> }
> }
>
> I've tried several ways to import and use the class (output pasted
> below:)
> C:\Program Files\WSO2\WSO2 Mashup Server\scripts>java -jar js.jar
> Rhino 1.6 release 7 2007 08 19
> js> importPackage(Packages.com.foo.bar.*);
> js> var tmpStr;
> js> tmpStr = Packages.com.foo.bar.doodaa.method1("test");
> js: "<stdin>", line 4: uncaught JavaScript runtime exception:
> TypeError: method1 is not a function, it is
> org.mozilla.javascript.NativeJavaPackage.
> js> importPackage(Packages.com.foo.bar.doodaa);
> js> tmpStr = Packages.com.foo.bar.doodaa.method1("test");
> js: "<stdin>", line 6: uncaught JavaScript runtime exception:
> TypeError: method1 is not a function, it is
> org.mozilla.javascript.NativeJavaPackage.
> js> importClass(Packages.com.foo.bar.doodaa);
> js: "<stdin>", line 7: Function importClass must be called with a
> class; had "[JavaPackage com.foo.bar.doodaa]" instead.
> js: "<stdin>", line 7: org.mozilla.javascript.EvaluatorException:
> Function importClass must be called with a class; had "[JavaPackage
> com.foo.bar.doodaa]" instead. (<stdin>#7)
> js>
>
> What am I doing wrong?
>
> Thanks
> Chad

Do you have com.foo.bar.doodaa in your classpath? It doesn't look like
it from your java command line.

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

Reply via email to