7

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)
Kannan Thangadurai
  • 1,117
  • 2
  • 17
  • 36

8 Answers8

8

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

Alex Shesterov
  • 26,085
  • 12
  • 82
  • 103
5
  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.
Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
3

You need to add the bin folder of your Java Development Kit (JDK) installation to the PATH environment variable. The java command works, because the JRE installs a copy of the java.exe executable in C:\ProgramData\Oracle\Java\javapath\ and adds it to the PATH.

For editing the PATH, see How do I set system environment variables in Windows 10? on superuser

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
1

Had the same problem. I set JAVA_HOME and wrapped it with double quotes ("").

JAVA_HOME="C:\Program Files\Java\jdk1.8.0_144"
IKavanagh
  • 6,089
  • 11
  • 42
  • 47
Tonnie
  • 4,865
  • 3
  • 34
  • 50
1

What you have is a JRE. You should install JDK and set JAVA_HOME. Then jshell will start working properly.

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108
user3567195
  • 441
  • 1
  • 5
  • 22
1

The same problem has happened to me. Uninstall and Install the right JDK from Oracle website.

steps: 1. Control Panel > System & Security > System > Change Setting > Advance > Change Environment Variable > System Variable > New > Variable Name:"Path" & Variable Value: "C:\Program Files\Java\jdk-10.0.1\bin" (address of the bin)> ok

You are good to go. Here's the link to the video that helped me.

https://www.youtube.com/watch?v=UokTaTwckDw

trupthi
  • 51
  • 3
1

Run you command prompt as Administrator. window -> cmd -> Run as Administrator then type jshell.

subhashis
  • 4,629
  • 8
  • 37
  • 52
1

Remove any default path variable that is set in envirnoment variables when you install JDK apart from JAVA_HOME.Then update your JAVA_HOME to /path of JDK 9 OR Above/

Chinmoy
  • 1,391
  • 13
  • 14