Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access Java 9 Jshell on mac

Tags:

macos

java-9

I have installed Jdk9 on MAC OSX and I have added the JDK path to bash_profile. When I use jshell command from terminal, I am getting 'Command not found' error. I am able to get the correct version number when I type command java -version.

How do I access the jshell from terminal? do i need to include jdk 9 bin folder path in bash_profile?

like image 449
Shravan Ramamurthy Avatar asked Sep 22 '17 18:09

Shravan Ramamurthy


People also ask

Is JShell introduced in Java 9?

JShell is a Java read-eval-print loop which was first introduced in the JDK 9.

How do I access JShell?

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


1 Answers

Add JDK-9 bin in PATH environment variable.

export PATH=/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin:$PATH
jshell
|  Welcome to JShell -- Version 9.0.1
|  For an introduction type: /help intro
jshell>
like image 111
Ahsan Kamal Avatar answered Sep 19 '22 18:09

Ahsan Kamal