Tag Archives: javascript

>Rhino on OS X Leopard

>When I was using Ubuntu as my main development environment I used rhino to try and learn Javascript in a bit more detail.

Coming back to OS X means that I wanted rhino but had no idea how to install. This is how I did it. If you come across this page and it’s wrong please let me know. I just wanted to get something running.

1. Get the source file and extract it. I used ftp://ftp.mozilla.org:21/pub/mozilla.org/js/rhino1_7R1.zip. Use unzip rhino_7R1.zip if it doesn’t extract.

2. In the top level you’ll see a js.jar file – copy that to /usr/share/java (sudo cp js.jar /usr/share/java)

3. Create the following script in /usr/local/bin/rhino (this is copied from the rhino install on Ubuntu Hardy)


/usr/bin/java -jar /usr/share/java/js.jar $@

4. Make it executable (chmod +x /usr/local/bin/rhino)

Now if you type rhino you can do the following

mbp:java icottee$ rhino 
Rhino 1.7 release 1 2008 03 06
js> x = 23 * 44
js> y = 'fish'
js> x
js> y

Truely you are a javascript god.