Rhino – A Great Javascript Debugger And Interactive Tester

Whether you are new to Javascript or experienced with the language, you will definitely need a debugger to make your life easier. While Google Chrome and Firefox have great Javascript debuggers, I personally use rhino in addition to those tools when I have a large Javascript program, and I need an excellent debugger.

What Is Rhino?

Rhino, is a program written in Java by the Mozilla project, which can execute, test, and debug Javascript code. For rhino, while using the shell, you can actually write Javascript code interactively, like using the python interpreter, or you can just execute Javascript code you wrote in a file.

Why Use Rhino?

When you are writing a sufficiently large Javascript program, inevitably you are going to make some kind of error in your code eventually. Sometimes the process of debugging is extremely annoying, and can make you feel like pulling your hair out because you can’t figure out what is wrong or why you aren’t getting the expected output. Rhino is an extremely powerful and useful tool to help you write better Javascript code, and helps you debug your code more easily.

While it is definitely recommended to test your code along the way, not just after you finish writing your program, having a great debugger can make your life much easier and more productive. Rhino, along with Firebug or Firefox’s default developer mode tools, are my preferred Javascript debuggers.

How To Download And Install Rhino

If you prefer to download binaries direct from Mozilla, you can download them here.

If you want to download the source code for rhino, you can download it here from github

How To Install Rhino In Debian Or Ubuntu

To install rhino in Debian or Ubuntu, simply type the command:
sudo apt-get install rhino

How To Use Rhino To Run A Script From A File

First, make sure that your Javascript code is written into a .js file. Only include Javascript code in the file. Do not include any HTML or CSS code in the .js file, otherwise there will be problems with debugging. Also, make sure to remove the

<script> and </script>

tags in the .js file. You can edit your HTML file later after fixing your Javascript code.

Once you have your .js file, open a terminal, and navigate to where your .js file is. Assuming your file is called example.js, do this command

rhino example.js

If there are some kind of errors in Javascript, rhino will output what the various errors are. You can then edit the .js file until there are no errors. Later, you can copy this fixed Javascript file back into your HTML file.

How To Use Rhino Interactively From The Shell

To use rhino interactively, simply open a terminal and type

then you will see output with something like

Rhino 1.7 release 4 2014 06 02

From here, you can write interactive Javacript. For example,
you can type:

var y= ["hello", "there"]
js> y

How To Learn To Use Rhino

Learning to use rhino will take a bit of practice. I recommend writing Javascript code into a .js file, and practicing executing the Javascript code with rhino in a terminal.

Where To Get Rhino documentation

The official Mozilla site for rhino has a great documentation site here

In addition, you can read about the rhino shell here. In Linux you can type
man rhino
to get some brief help on the rhino command.


Rhino is a great Javascript debugger which can make your coding in Javascript much faster and more productive. rhino, like many tools, is best learned through actually using it and testing it. Along with Firefox and Chrome developer tools, rhino has excellent Javascript debugging capabilities to help you write better Javascript code.

One thought on “Rhino – A Great Javascript Debugger And Interactive Tester”

Leave a Reply

Your email address will not be published. Required fields are marked *