On Jul 30, 6:19 pm, "Gil Jones" <[EMAIL PROTECTED]> wrote:
> I can't get some of the examples from the Rhino tutorials to work. I
> specifically want to figure out how to create a simple Java object be able
> to call it from within a javascript. I downloaded the Rhino source version
> rhino1_7R1 and I'm trying to run some of the example commands from a Windows
> cmd prompt.
>
> I was able to get the commands to work that create a Java frame that pops up
> a window with an OK button. What I want to get working is the Counter
> example. Here's my results...notice I had to add the .; to get the
> classpath to work.
>
> C:\Rhino>java -cp '.;js.jar;examples'
> org.mozilla.javascript.tools.shell.Main
> Rhino 1.7 release 1 2008 03 06
> js> defineClass("Counter")
> js: "<stdin>", line 2: Class "Counter" not found.
> at <stdin>:2
>
> js>
>
> I'm able to compile the CounterTest.java file and execute it which created a
> Counter.class file. I've tried copying the Counter.java and Counter.class
> files up into the directory I'm executing from...I just can't find anything
> that get's this counter class to work from the shell or from within a .js
> file.
>
> Gil
Here's how I got it to work on Windows:
[build] cd rhino1_7R2pre/
[rhino1_7R2pre] cd examples/
[examples] javac -cp ../js.jar Counter.java
[examples] java -cp '../js.jar;.'
org.mozilla.javascript.tools.shell.Main
Rhino 1.7 release 2 PRERELEASE 2008 07 30
js> defineClass("Counter")
js> var c = new Counter()
js> c.count
0
js> c.count
1
js> c.resetCount()
js> c.count
0
--Norris
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino