JShell


JShell is a Java read-eval-print loop tool first introduced in the JDK 9. It is tracked by JEP 222: jshell: The Java Shell.
One of the reasons JShell was proposed for Java 9 is that a lot of applications use their own mechanisms to interactively evaluate expressions, and the de facto library to use a Java REPL was often BeanShell, which is a dormant project since 2003, and which made arbitrary changes to the Java language.

Example


$ jshell
jshell> int a =
a > int
jshell> int fact
jshell> for
...> a = fact;
jshell> a
a > int
jshell> /exit