0

I am trying to use jshell to learn basic Java behavior. When I use terminal to navigate to the directory where jshell is located:

cd /Library/Java/JavaVirtualMachines/jdk-11.0.6.jdk/Contents/Home/bin

And then type jshell into the command prompt, I get the following error:

Error: Could not find Java SE Runtime Environment.

This is peculiar because java code in my Eclipse IDE (Version: 2019-12 (4.14.0)) compiles and executes just fine on this computer. Also, when I type java -version into terminal it yields the following:

java version "11.0.6" 2020-01-14 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode)

So clearly the runtime environment is installed, but jshell can't access it for some reason. The best I can figure, I need to find where the JRE is installed and then add it to my $PATH, but I've got not clue how to do this.

1 Answers1

0

Silly me. Because I wanted to make the jshell command executable from any directory, I copied (cp) it to my bin. However, this caused the command "jshell" to override any attempt to execute jshell from within the directory where it was originally installed. I deleted it from my bin and now it works fine.