Home of The JavaSpecialists' Newsletter

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

Previous          Next

Previous          Next

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.



About the Author

demo

Java Champion, author of the Javaspecialists Newsletter, conference speaking regular... About Heinz

Java Training

We deliver relevant courses, by top Java developers to produce more resourceful and efficient programmers within their organisations.

Java Consulting

Nobody ever wants to call a Java performance consultant, but with first-hand experience repairing and improving commercial Java applications - JavaSpecialists are a good place to start...

Threading Emergency?

If your system is down, we will review it for 15 minutes and give you our findings for just 1 € without any obligation.