Java – unable to execute jshell from Mac terminal

I currently use Java 1.8 on MAC Sierra

java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03,mixed mode)

Now I want to run "jshell" to execute simple java commands directly from the terminal But I finally got the following error message –

Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/bin/jshell" (-1)

What do I need to do to avoid this error message?

Solution

As @ Elliott pointed out, you need to download and install java-9 to use jshell

Set the environment variable to use / JDK.. // After the bin directory You can execute the command jshell on the command line to continue

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>