出於好奇,我決定玩JShell。 現在,我要通過這些Examples錯誤:無法找到符號 - 每個命令
而我不知道如何使用它。我正在使用JDK 9 - 108 build 和簡單的Linux shell命令似乎不起作用。我試過ls
,cd
,mkdir
和我得到的是:
Error: cannot find symbol
出於好奇,我決定玩JShell。 現在,我要通過這些Examples錯誤:無法找到符號 - 每個命令
而我不知道如何使用它。我正在使用JDK 9 - 108 build 和簡單的Linux shell命令似乎不起作用。我試過ls
,cd
,mkdir
和我得到的是:
Error: cannot find symbol
的例子是東西比隨Java 9的JShell完全不同。從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:
的JShell附有Java 9並不意味着與操作系統交互,但是在運行的JVM拋出的Java代碼片段,這嘗試的事情。從您的其他鏈接:
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.
所以這只是一個不幸的名字衝突。
Robert Field(real JShell的設計者)在Devoxx上給出了很好的介紹。如果你可以騰出一個小時的話,看看它here。