Class RhinoScriptEngine

java.lang.Object
javax.script.AbstractScriptEngine
org.mozilla.javascript.engine.RhinoScriptEngine
All Implemented Interfaces:
Compilable, Invocable, ScriptEngine

public class RhinoScriptEngine extends AbstractScriptEngine implements Compilable, Invocable
This is the implementation of the standard ScriptEngine interface for Rhino.

An instance of the Rhino ScriptEngine is fully self-contained. Bindings at the GLOBAL_SCOPE may be set, but there is nothing special about them -- if both global and ENGINE_SCOPE bindings are set then the "engine" bindings override the global ones.

The Rhino engine is not thread safe. Rhino does no synchronization of ScriptEngine instances and no synchronization of Bindings instances. It is up to the caller to ensure that the ScriptEngine and all its Bindings are used by a single thread at a time.

The Rhino script engine includes some top-level built-in functions. See the Builtins class for more documentation.

The engine supports a few configuration parameters that may be set at the "engine scope". Both are numbers that may be set to a String or Number object.

  • javax.script.language_version: The version of the JavaScript language supported, which is an integer defined in the Context class. The default is the latest "ES6" version, defined as 200.
  • org.mozilla.javascript.optimization_level: The level of optimization Rhino performs on the generated bytecode. Default is 9, which is the most. Set to -1 to use interpreted mode.