Reputation: 3399
Out of curiosity, I decided to play with JShell. Now, I'm going through these Examples
And I can't figure out how to use it. I'm using the JDK 9 - 108 build
and the simple Linux shell commands doesn't seem to work. I tried ls
, cd
, mkdir
and all I get is:
Error: cannot find symbol
Upvotes: 3
Views: 1899
Reputation: 51060
The examples are for something completely different than the JShell shipped with Java 9. From the first section of the page you link to:
JShell is a UNIX-like shell written in Java, and intended primarily for working with Java programs. It was written to overcome the problems in working with Java on the Psion 5mx:
The JShell shipped with Java 9 is not meant to interact with the operating system but to throw Java snippets at a running JVM and this try out things. From your other link:
REPL allows you to evaluate code snippets such as declarations, statements, expressions. You can test your code as you create it, and way before you are done with your whole project.
So this is just an unfortunate name clash.
Robert Field (designer of the real JShell) gave a great introduction to it at Devoxx. See it here if you can spare an hour.
Upvotes: 2