Takes Mozilla JavaScript engine Rhino (version and builds an adapter for it so that it can be used in Java scripting.

Why would I want to use Rhino

Java already has Java JavaScripting. In Java 7 it was a modified Rhino. In Java 8 it is a new engine called "Nashorn".

But maybe you have some technical reason why you prefer Mozilla's Rhino which has some special functionalities that are not in Nashorn.

Or you may want to use Java's JavaScript in Google App Engine, where even the Nashorn engine is not included.

How do I use it?

The code is a Maven project.

It is easy to change the included JavaScript engine from Rhino to something else.

In your project, add rhino-js-engine as a dependency:


You don't need to add Rhino itself since it is pulled in by rhino-js-engine.

In your java code, get the scripting engine called "rhino":

import javax.script.*;

ScriptEngineManager manager=new ScriptEngineManager();
ScriptEngine engine=manager.getEngineByName("rhino");

Now you can call the script engine methods: