java.scripting/com.sun.tools.script.shell.Main - JavaScript Shell

Q

How to run "java.scripting/com.sun.tools.script.shell.Main" tool from JDK lib\modules JImage file?

✍: FYIcenter

A

"java.scripting/com.sun.tools.script.shell.Main" tool allows you to start the Nashorn JavaScript shell.

"java.scripting/com.sun.tools.script.shell.Main" tool is supported by the jmods\jdk.scripting.jmod module file, which is also linked into the lib\modules JImage file.

"java.scripting/com.sun.tools.script.shell.Main" tool using the lib\modules JImage file as described below using JDK 17 as an example:

fyicenter> %JDK_HOME%\bin\java --module java.scripting/com.sun.tools.script.shell.Main

script engine for language js can not be found

So there is no default JavaScript engine in JDK 17.

If you run the same command in JDK 11, you will get the Nashorn engine:

fyicenter> %JDK_HOME%\bin\java --module java.scripting/com.sun.tools.script.shell.Main

Warning: Nashorn engine is planned to be removed from a future JDK release

nashorn> print("Hello world!");
Hello world!

nashorn> 1+2;
3

nashorn> quit()

 

java.xml/com.sun.org.apache.xerces.internal.impl.xpath.regex.REUtil - Regular Expression Tool

java.base/sun.security.tools.keytool.Main - "keytool" Command

Tools Supported from JDK 9+ lib\modules JImage

⇑⇑ FAQ for JDK (Java Development Kit)

2019-10-18, 1553🔥, 0💬