Slide deck + code examples and snippets for GeeCON JShell talk
JavaScript CSS Java HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Java and REPL. Forget debugging, welcome joy and productivity


Oh Java, my old, lousy and boilerplated friend. For ages, trying anything new (which luckily wasn’t that frequent after all) required starting a new project, followed by a Sandbox class and a public static void main method. Alternatively, a simple JUnit test was a nice entrypointt as well - if we were lucky enough to have some dependency management sorted out.

Thankfully, things have changed. With the Java9 a REPL has been introduced, everybody can just run an up-to-date Java shell and try out new syntaxt, new APIs, new libraries. Now we can feel like Scala, Clojure, Ruby, JavaScript, PHP, call whatever language developers - finally there.

In this talk I’ll walk through essential REPL examples, see how we can use JShell to try out new language features (like Java 10 var syntax, Java 9 Streams enhancements), but foremost, we will use it to build a real-life web application. Expect meat-only talk without theory, diagrams, useless "javax.swing.*" application examples.


  • explain jshell

  • show some basic new Java9 features in the shell

  • show shell’s edit function based on exploring regular expressions and walking file trees

  • build a simple web application in shell (with SparkJava)

  • add web application features (web sockets)

  • showcase direct jshell to app communication

  • save the code from the jshell to be able to refactor it within the IDE

  • (optional) cover java9 module as an essential part of jshell environment

What do we get with a REPL workflow

  1. Learn the new language and libraries

  2. Write code with immediate feedback

  3. No build or deploy

  4. Easy way of creating faithful lies for our test

  5. Tools to understand the real world

  6. Fewer surprises when starting the application

  7. Add new libraries to a running application

  8. Run automatically unit test affected by a change

  9. Inspect and manage the state

  10. Stay in comfort of your favourite IDE

  11. Debug staging and production

Connect to jshell remotly, run jshell from the IDE


Daniel Lebrero - REPL Driven Development
Robert Field - JShell: An Interactive Shell for the Java Platform
Roy van Rijn - Brace Yourselves, the REPL is Coming
Interactive Java Support to your tool, Robert Field
Java9 modules