How to access Java 9 Jshell on Mac

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

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

+4
source share
3 answers

Yes. All you have to do is configure in the bash_profile file, which can be done as: $JAVA_HOME/bin

enter image description here and then confirm the java version at your prompt.

enter image description here

PS : all other variables in bash_profileexcept JAVA_HOMEand PATHin the profile can be ignored.

+3

JDK-9 PATH.

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>
+3

.bash_profile

:

export PATH=$PATH:/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin

jshell .


/Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin $PATH, /, /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home/bin

$PATH -

echo $PATH , , $PATH.

directory= , $PATH

  • PATH=directory:$PATH
  • PATH=$PATH:directory
0

Source: https://habr.com/ru/post/1686243/


All Articles