Java Tutorials by Dr Heinz Kabutz

Java 9 brings us a revamped and overhauled BeanShell that uses standard Java syntax for the scripting. In this tutorial, we demonstrate how to get started. We look at the start-up speed and explain why it is so much worse than other languages. We also show how our performance overtakes other languages once the classes are optimized and compiled, producing many factors speed improvements.

Even though it is not recommended or fully supported, we show how we can write unix scripts by declaring the path to jshell in the first line, prepended with "#!".

Lastly, we write a simple echo server using (mostly) anonymous variables.

JShell is a welcome addition to Java 9, but most of its users will probably be experienced Java programmers who already have a decent idea of what classes are available in the JDK. For beginners, sticking with a good IDE would be preferable.

Audience: beginner to intermediate Java programmers

Enjoyed this tutorial? Be sure to check out our advanced Java courses.

Java Tutorial 008 - JShell, the new Java 9 REPL for Interactive Hacking

We hope you enjoyed this tutorial. If you did, you will also enjoy our courses. We suggest you start with Extreme Java - Advanced Java, followed by Extreme Java - Concurrency Performance for Java 8.