Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
Collections:
Other Resources:
JavaScriptEngineInfo.java - JavaScript Engine Details
How to get JavaScript Engine detailed information from the SJP API?
✍: FYIcenter
If you want to verify the JavaScript Engine detailed information, you can try the following example program:
// Copyright (c) 2017 FYIcenter.com import javax.script.ScriptEngineManager; import javax.script.ScriptEngine; import javax.script.ScriptEngineFactory; public class JavaScriptEngineInfo { public static void main(String[] args) throws Exception { ScriptEngineManager m = new ScriptEngineManager(); ScriptEngine e = m.getEngineByName("JavaScript"); System.out.println("\nFrom JavaScript:"); e.eval("print(' Hello world!')"); ScriptEngineFactory f = e.getFactory(); System.out.println("\nJavaScript 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(" Engine class: "+e.getClass().getName()); System.out.println(" Factory class: "+f.getClass().getName()); System.out.println(" Manager class: "+m.getClass().getName()); } }
Compile the example with Java SE 7 JDK compiler:
>\fyicenter\jdk-1.7.0\bin\javac JavaScriptEngineInfo.java >\fyicenter\jdk-1.7.0\bin\java JavaScriptEngineInfo From JavaScript: Hello world! JavaScript engine info: Engine name: Mozilla Rhino Engine version: 1.7 release 3 PRERELEASE Language name: ECMAScript Language version: 1.8 Engine class: com.sun.script.javascript.RhinoScriptEngine Factory class: com.sun.script.javascript.RhinoScriptEngineFactory Manager class: javax.script.ScriptEngineManager
The output tells you the Rhino JavaScript library is the default JavaScript engine in Java SE 7.
⇒ JavaScript Engine Changed in Java SE 8
⇐ JavaScriptHello - SJP API Hello Example
2017-07-25, 1661🔥, 0💬
Popular Posts:
JDK 11 jdk.internal.opt.jmod is the JMOD file for JDK 11 Internal Opt module. JDK 11 Internal Opt mo...
How to run "jar" command from JDK tools.jar file? "jar" is the JAR (Java Archive) file management co...
What Is junit-3.8.1.jar? junit-3.8.1.jar is the version 3.8.1 of JUnit JAR library file. JUnit is a ...
What Is poi-ooxml-3.5.jar? poi-ooxml-3.5.jar is one of the JAR files for Apache POI 3.5, which provi...
How to download and install iText7-Core-7.1.4.zip? iText7-Core-7.1.4.zip is the binary package of iT...