Thomas,
Yes you can do what you want. You have to set up the java classpath correctly so that it will find rhino as well as any libraries you want. So
java -cp whatever or -classpath whatever
Then you need to specify that rhino main will run
java -cp whatever org.mozilla.javascript.tools.shell.Main
(note you can also start the rhino debugger instead of the shell).
At this point you will have an interactive shell
If you want to load a javascript file you can also specify the a
-f somefile.js option.
If you get messages about org.mozilla...Main class not found it means your class path is not set up correctly.

I'm not sure if I have the exact syntax or sequence of arguments, but that is basically the idea. Good luck. And if you want to do interactive js, then I highly recommend adding incorporating the jline.ConsoleRunner which makes it easier.
Terry


Thomas Allen wrote:
Hi Ahmed,

I was under the impression that Rhino could be used as a stand-alone JS engine, and that by running on the JVM, it could seamlessly work with existing libraries. Is there any good reason that all logic couldn't be in JavaScript (other than accessing library APIs)?

Thomas

Ahmed Ashour wrote:
Dear Thomas,

my code will be JavaScript, but that I'll have to know enough Java to understand library APIs so I can take advantage of them from within Rhino.


The usual Rhino usage: your main code is Java, and you embed Rhino to be able to process JavaScript logic. However, you can implement needed functions/properties in Java and call them from JavaScript.

In both ways, you have to know how to implement some logic in Java.

Again, we are here if you need help,

Ahmed

----- Original Message ----
From: Thomas Allen <[EMAIL PROTECTED]>
To: Ahmed Ashour <[EMAIL PROTECTED]>
Cc: [email protected]
Sent: Wednesday, October 15, 2008 4:17:56 PM
Subject: Re: The Simplest Question: How to Install?

Hi Ahmed,

Thanks for the patience. I want to use Rhino to develop web apps with the benefit of being able to leverage existing Java libraries. What sparked my
interest was an interview with Steve Yegge who was tasked with porting
Rails to JavaScript and Google, and who chose Rhino for the project (I
don't intend to port Rails). I've considered other JS engines, but a large standard library is essential for web app programming, and Rhino seems to
be the best in that arena.

My understanding is that with Rhino, my code will be JavaScript, but that
I'll have to know enough Java to understand library APIs so I can take
advantage of them from within Rhino.

Thomas



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

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

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

Reply via email to