This guide covers most aspects of the jshell. I distilled it from playing around with jshell and poking
around in the jshell source code. Some parts of this guide, especially the section ‘feedback mode’ and
searching through the history, draw on Robert Field’s JShell Manual, which is definitely worth checking out.
The link to it is in the ‘reference’ section.
created on | January 28, 2022 |
The jshell is a great tool for exploring libraries, testing new features of Java and for explorative programming in general....
created on | January 28, 2022 |
jshell accepts the following JLS syntax: Statements Expressions Variable, Method, Class and Interface...
created on | January 28, 2022 |
history jshell maintains a history that includes all previously entered commands and snippets...
created on | January 28, 2022 |
Variables can be explicitly declared. For expression that don’t have a named variable, an implicit variable...
created on | January 28, 2022 |
On startup, jshell imports a bunch of Java packages by default. Imported packages can be listed with...
created on | January 28, 2022 |
Inside methods, classes and interfaces, statements have to end with a semicolon...
created on | January 28, 2022 |
In order to be able to access classes in libs or class files that are not part of the JDK, the classpath must be set...
created on | January 28, 2022 |
In order to be able to access modules that are not part of the JDK, the module path must be set according to the...
created on | January 28, 2022 |
If a snippet throws an exception, jshell prints the exception together with the snippet id that caused the exception...
created on | January 28, 2022 |
Tab completion works for commands, command parameters, variables, methods, classes and interfaces...
created on | January 28, 2022 |
available feedback modes JShell comes with four built-in feedback modes, listed in the table below...
created on | January 28, 2022 |
A jshell script file is a sequence of jshell commands and/or snippets, one command or snippet per line...
created on | January 28, 2022 |
the jshell configuration file On Linux systems, the startup configuration is written to the file ~/....
created on | January 28, 2022 |
last modified on | March 26, 2022 |
some of the information presented in this series JShell guide stems from the following references:...