Running on Java 24-ea+24-2960 (Preview)
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

Comments

When you load these comments, you'll be connected to Disqus. Privacy Statement.

Table of Contents

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

Heinz Kabutz Java Conference Speaker

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

Superpack '23

Superpack '23 Our entire Java Specialists Training in one huge bundle more...

Free Java Book

Dynamic Proxies in Java Book
Java Training

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

Java Consulting

We can help make your Java application run faster and trouble-shoot concurrency and performance bugs...