Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'jshell' is not recognized as an internal or external command

I am using the 'jshell command in my machine it is not recognised. But java command is working fine. is there any environment setup for jshell in jdk 10

C:\Users\Kannan
λ jshell
'jshell' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\Kannan
λ java -version
java version "10" 2018-03-20
Java(TM) SE Runtime Environment 18.3 (build 10+46)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10+46, mixed mode)
like image 537
Kannan Thangadurai Avatar asked Mar 26 '18 17:03

Kannan Thangadurai


People also ask

How do I activate JShell?

To start JShell, enter the jshell command on the command line. JDK 9 must be installed on your system. If your path doesn't include java-home/jdk-9/bin , start the tool from within that directory.

Why JShell is not recognized?

If you are trying to access jshell on Mac OS X and getting the following error(jshell: command not found) that means you have to configure the $JAVA_HOME/bin in your bash_profile. Note: To start jshell you must have java 9 installed on your system. This feature is added in java9 version.

How do I run a JShell in terminal?

To start Jshell, first we must have installed Java 9 then open terminal in Linux or command prompt in windows and type jshell. It will start jshell session and displays a welcome message to the console. To display a simple “Hello Java” message, write print command without creating class and hit enter.


2 Answers

jshell is a part of JDK 10 and it's located in the %JAVA_HOME%\bin folder on Windows.

Possible problems:

  1. You installed JRE 10 only (instead of JDK 10). jshell is NOT part of the JRE.

  2. %JAVA_HOME%\bin is not part of the PATH system variable.

See also: Environment variables for java installation

like image 135
Alex Shesterov Avatar answered Oct 15 '22 04:10

Alex Shesterov


  1. check if jshell is installed with your Java environment. ls [JAVA-INSTALLEDPATH]/bin
  2. if jshell does not exist download appropriate JDK
  3. if jshell is present append path in your environment profile or use full path.
like image 30
Dwight J. Browne Avatar answered Oct 15 '22 05:10

Dwight J. Browne