X

Topics and trends related to the Java ecosystem with occasional random rants.

  • Sun
    July 24, 2015

New for Java 9: jshell

James Connors
Principal Solutions Consultant

A sampling of indices gauging computer programming language popularity (e.g. PYPL and TIBOE) shows that Java, after 20 years, still enjoys a huge following.  In general, depending upon whom and/or when you ask, Java usually comes in first or second place in these surveys.  Although it might be hard to imagine recent computer science graduates without Java exposure, one trend is evident: top universities are gravitating towards teaching "simpler" languages in lieu of Java for their introductory programming classes.

The standard Java platform, compared to its counterparts like Python, currently lacks a Read-Eval-Print-Loop otherwise known as a REPL.  Instead of having to construct and compile complete syntactically correct programs before feedback can be achieved, REPLs allow much more interactivity, enabling the student/programmer to enter small snippets of code and receive immediate feedback.  According to the Java Enhancement Proposal which outlines the new jshell functionality, "The number one reason schools cite for moving away from Java as a
teaching language is that other languages have a "REPL" and have far lower
bars to an initial "Hello, world!" program."  With the introduction of jshell in the upcoming Java 9 release, this shortcoming will be eliminated.

Falling under the auspices of an OpenJDK project called Kulla, the code representing the REPL capability has yet to be incorporated into the core JDK 9 early access release.  As of the writing of this article (late July 2015), a separate build is required to get the jshell functionality.  In the (hopefully not-too-distant) future an early access release will bundle all these features together obviating the need for extra work.  In the interim, here's a brief video demonstrating some of it's features.

As we near the "feature complete" phase for JDK 9, we look forward to better integration and incorporation of yet more new important features into this upcoming release.

Join the discussion

Comments ( 8 )
  • Ray Friday, July 31, 2015

    How is this different from Groovy shell?


  • javosize Saturday, August 1, 2015

    jShell providing REPL capabilities are cool, but what if with any java version (1.5+) you could attach something that provides jShell capabilities and more to a running JVM? This is one the things javosize does. What do you think?


  • Jim Connors Monday, August 3, 2015

    First and foremost, irrespective of the comparisons, jshell will be part of the standard Java 9 release.


  • Sachith Wednesday, August 19, 2015

    This might worthy for Linux environment. If we could use this with shell scripts, this will be more powerful tool. Will see after look.


  • guest Wednesday, August 19, 2015

    Beanshell did it in 2005, it even had a nice graphical frontend


  • Alan Williamson Wednesday, August 19, 2015

    @Jim i think this is a wonderful, and long overdue, feature of the core Java. This is a wonderful teaching tool that will definitely help cement the continued usage of Java in the academic space.


  • notzed Thursday, August 20, 2015

    jshell+rmi+standardised rendezvous == system-wide arexx-like 'meta-app' functionality (at last)?


  • guest Wednesday, March 29, 2017

    Here is a web frontend in case someone likes to quickly get a feel of what JShell could do http://137.74.64.141/jshell-frontend/


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.