jshell

jShell is a Java REPL planned to be included in the JRE for Java 9.[1] It is tracked by JEP 222: jshell: The Java Shell (Read-Eval-Print Loop).[2]

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.[3][4]

Example

jshell> int x=5
x ==> 5
|  created variable x : int

jshell> x
x ==> 5
|  value of x : int

See also

References

  1. "What REPL means for Java". JavaWorld. 2015-08-13. Retrieved 2016-11-01.
  2. "JEP 222: jshell: The Java Shell (Read-Eval-Print Loop)". Oracle Corporation. 2016-10-10. Retrieved 2016-11-01. Provide an interactive tool to evaluate declarations, statements, and expressions of the Java programming language, together with an API so that other applications can leverage this functionality
  3. "JEP 222: jshell: The Java Shell (Read-Eval-Print Loop)". Oracle Corporation. 2016-10-10. Retrieved 2016-11-01. Another alternative is to maintain the status quo: Use another language or use a third-party REPL such as BeanShell, though that particular REPL has been dormant for many years, is based on JDK 1.3, and makes arbitrary changes to the language.
  4. "JShell, the Java 9 REPL – What does it do?". jaxenter.com. 2015-09-03. Retrieved 2016-11-01. BeanShell (just like Groovy, too by the way) made an attempt of standardisation by the Java Community Process in JSR 274 – a JSR that did not produce any notable output, in spite of the fact that (or perhaps because?) two major companies, Sun and Google, had joined the expert group. Under the JCP.next initiative this JSR was declared “Dormant”.
This article is issued from Wikipedia - version of the 11/1/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.