Run Rhino 1.7R5 JavaScript Engine under SJP API

Q

How to run Rhino 1.7R5 JavaScript Engine under SJP (Scripting for the Java Platform) API? I have Rhino 1.7R5 and rhino-js-engine-1.7.7.1.jar installed.

✍: FYIcenter

A

run Rhino 1.7R5 JavaScript Engine under SJP (Scripting for the Java Platform) API, you need to install:

1. Rhino 1.7R5 Java library - Take the js.jar from the installation:

>dir \fyicenter\rhino1_7R5

01/29/2015  04:38 PM         1,142,627 js.jar

2. Rhino to SJP Wrapper library - Take the rhino-js-engine-1.7.7.1.jar from the installation:

>dir \fyicenter\

40,771 rhino-js-engine-1.7.7.1.jar

Compile and run the example program, JavaScriptRhinoEngine.java, given the previous tutorial, with two JAR files mentioned above:

>\fyicenter\jdk-1.8.0\bin\java 
   -cp .;\fyicenter\rhino1_7R5\js.jar;\fyicenter\rhino-js-engine-1.7.7.1.jar 
   JavaScriptRhinoEngine

Script Engines:
   Engine name: Oracle Nashorn
   Engine name: Mozilla Rhino
      Selected...

From Mozilla Rhino:
   Hello world!

JavaScript engine info:
   Engine name: Mozilla Rhino
   Engine version: 1.7.7.1
   Language name: ECMAScript
   Language version: 1.7
   Engine class: com.sun.phobos.script.javascript.RhinoScriptEngine
   Factory class: com.sun.phobos.script.javascript.RhinoScriptEngineFactory
   Manager class: javax.script.ScriptEngineManager

 

SJP (Scripting for the Java Platform) API

⇒⇒FAQ for Rhino JavaScript Java Library

2017-07-17, 119👍, 0💬