Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JavaScriptEngineList.java - Load SJP Reference Implementation
How to load the the SJP Reference Implementation Script Engine?
✍: FYIcenter
To load the SJP Reference Implementation Script Engine,
you just need to add "sjp-1_0-fr-ri\script-js.jar" to the "-cp" JVM option.
Take the following example program, JavaScriptEngineList.java, to verify how many script engines are loaded:
// Copyright (c) 2017 FYIcenter.com
import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
import java.util.*;
public class JavaScriptEngineList {
public static void main(String[] args) throws Exception {
ScriptEngineManager m = new ScriptEngineManager();
List<ScriptEngineFactory> l = m.getEngineFactories();
System.out.println("\nScript Engines:");
for (ScriptEngineFactory f : l) {
System.out.println("\n Engine info:");
System.out.println(" Engine name: "+f.getEngineName());
System.out.println(" Engine version: "+f.getEngineVersion());
System.out.println(" Language name: "+f.getLanguageName());
System.out.println(" Language version: "+f.getLanguageVersion());
System.out.println(" Factory class: "+f.getClass().getName());
}
}
}
Compile and run the example program, JavaScriptEngineList.java:
>\fyicenter\jdk-1.8.0\bin\javac JavaScriptEngineList.java
>\fyicenter\jdk-1.8.0\bin\java
-cp .;\fyicenter\sjp-1_0-fr-ri\script-js.jar JavaScriptEngineList
Script Engines:
Engine info:
Engine name: Oracle Nashorn
Engine version: 1.8.0_131
Language name: ECMAScript
Language version: ECMA - 262 Edition 5.1
Factory class: jdk.nashorn.api.scripting.NashornScriptEngineFactory
Engine info:
Engine name: Mozilla Rhino
Engine version: 1.6 release 2
Language name: ECMAScript
Language version: 1.6
Factory class: com.sun.script.javascript.RhinoScriptEngineFactory
The output tells you the reference implementation of SJP API is really the Rhino 1.6R2 JavaScript Java library.
⇒ JavaScriptRhinoEngine.java - Select SJP RI Engine: Rhino
⇐ What Is js.jar in SJP RI sjp-1_0-fr-ri.zip
2017-07-21, ∼2261🔥, 0💬
Popular Posts:
JDK 17 java.xml.jmod is the JMOD file for JDK 17 XML (eXtensible Markup Language) module. JDK 17 XML...
JDK 11 jdk.crypto.cryptoki.jmod is the JMOD file for JDK 11 Crypto Cryptoki module. JDK 11 Crypto KI...
JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "jav...
JDK 17 java.management.jmod is the JMOD file for JDK 17 Management module. JDK 17 Management module ...
JDK 11 jdk.internal.vm.compiler .jmodis the JMOD file for JDK 11 Internal VM Compiler module. JDK 11...