Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

The Simplest Question: How to Install?

1,085 views
Skip to first unread message

Thomas Allen

unread,
Oct 15, 2008, 8:03:29 AM10/15/08
to dev-tech-js-...@lists.mozilla.org
I'm a hardcore JavaScript developer, and I'm looking to run JS on the
server. I'm going with Rhino for portability (JVM) and libraries, and
also because it seems to be the most mature SSJS platform.

However, I'm completely lost when it comes to running most anything
Java, being a frontend web developer and a LAMP dev on the side. I've
pored over the Mozilla docs for Rhino, and I couldn't come up with
anything about how to install Rhino. The closest I found was here:

Here's my Java information:
$ java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

So, how can I install Rhino? I downloaded 1.7R1, and don't know what I
need to do next.

Thanks,
Thomas

Ahmed Ashour

unread,
Oct 15, 2008, 8:59:42 AM10/15/08
to dev-tech-js-...@lists.mozilla.org
Dear Thomas,

>>I'm looking to run JS on the server.

Can you elaborate more, what exactly do you want to use rhino for?

A quick feedback would be: if you want to use Rhino, you have to know the basics of Java, a quick reference lies in http://java.sun.com/tutorial

Rhino is not a ready-made product that you install and run, but it is a library you use it along with your code.

Please don't hesitate to ask, if you have further questions,

Ahmed

Thanks,
Thomas
_______________________________________________
dev-tech-js-engine-rhino mailing list
dev-tech-js-...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino


Thomas Allen

unread,
Oct 15, 2008, 9:17:56 AM10/15/08
to Ahmed Ashour, dev-tech-js-...@lists.mozilla.org
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

P.S. Sorry I re-sent this, I didn't CC the mailing list on the first send.

Ahmed Ashour

unread,
Oct 15, 2008, 1:04:58 PM10/15/08
to dev-tech-js-...@lists.mozilla.org
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,

Thomas Allen

unread,
Oct 15, 2008, 5:31:38 PM10/15/08
to Ahmed Ashour, dev-tech-js-...@lists.mozilla.org
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

Ruland Kevin-BHP637

unread,
Oct 15, 2008, 5:32:59 PM10/15/08
to Thomas Allen, Ahmed Ashour, dev-tech-js-...@lists.mozilla.org
Thomas,

Have you looked at Helma? It might be what you want.

http://dev.helma.org/

Kevin

Thomas Allen

unread,
Oct 15, 2008, 5:47:44 PM10/15/08
to Ruland Kevin-BHP637, dev-tech-js-...@lists.mozilla.org
But that runs on Rhino, so I'll still need to find an answer to my
original question. I have Java. I downloaded Rhino. I've been unable to
find a single source that says, "OK, obviously part of our audience
hasn't touched Java and wants to give JavaScript a spin outside of the
browser, so here's how you guys can get up and running." I'm not looking
for hands-on help here, just a link that can answer this question.

Thomas

Terry Braun

unread,
Oct 15, 2008, 5:59:19 PM10/15/08
to Thomas Allen, dev-tech-js-...@lists.mozilla.org
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

unread,
Oct 15, 2008, 6:04:58 PM10/15/08
to Terry Braun, dev-tech-js-...@lists.mozilla.org
Thanks Terry, I appreciate it. So I see it boils down to getting the
classpath right, which I can look into now. I'm definitely interested in
using Rhino's JS shell, because I hate having to go into Firefox
(Firebug) for a good interpretive environment. This will also almost
certainly be a door for me into Java, as opposed to [PJ]ython, because
JavaScript isn't "batteries included."

Thomas

0 new messages