jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider - "jshell" Command


How to run "jshell" command from JDK lib\modules JImage file?

✍: FYIcenter


"jshell" command allows you to run JShell interactively.

"jshell" command is supported by the jmods\jdk.jshell.jmod module file, which is also linked into the lib\modules JImage file in JDK 9, 10, and 11.

You can run the "jshell" command using the lib\modules JImage file as described below using JDK 11 as an example:

C:\fyicenter>set JDK_HOME=\fyicenter\jdk-11.0.1

C:\fyicenter>%JDK_HOME%\bin\java --module jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider

|  Welcome to JShell -- Version 11.0.1
|  For an introduction type: /help intro

jshell> System.out.println("Hello world!");
Hello world!

jshell> 1+2;
$1 ==> 3



⇒ jdk.jstatd/sun.tools.jstatd.Jstatd - "jstatd" Command

⇐ jdk.jlink/jdk.tools.jmod.Main - "jmod" Command

⇑ Tools Supported from JDK 9+ lib\modules JImage

⇑⇑ FAQ for JDK (Java Development Kit)

2019-05-14, 1326👍, 0💬