Java Full-Stack Report February 2023: New & Noteworthy
Last month’s most important news for Java developers: We can now write command-line interfaces with Java, this book will save IntelliJ users tons of time, and better debugging with Kotlin 1.8. And yes, it’s still a slow news time!
Table Of Contents
- What’s This?
- New & Noteworthy
New & Noteworthy
We Can Now Write Command-Line Interfaces with Java
Command-line interfaces (CLI) need to start quickly and not use much memory. Sot that ruled out writing them in Java for most of us: Sure, Maven and Gradle start fast. But they’ve been tuned for years and don’t use the frameworks we want to use, like Spring Boot.
Until now, that is: Native Java with GraalVM makes it possible to write CLIs in Java!
just is an example of such a CLI. It doesn’t matter to us that it’s a Spring Boot tool. What matters is that it’s a Spring Boot application starts in less than one second. On my M1 Max MacBook Pro, the application launches, displays the help screen, and quits again in 0.8 seconds:
% time just --help ██╗██╗ ██╗███████╗████████╗ ██║██║ ██║██╔════╝╚══██╔══╝ ██║██║ ██║███████╗ ██║ ██ ██║██║ ██║╚════██║ ██║ ╚█████╔╝╚██████╔╝███████║ ██║ ╚════╝ ╚═════╝ ╚══════╝ ╚═╝ Unknown option: '--help' Usage: just [-V] [COMMAND] -V, --version Print Just version Commands: run runs Spring Boot project - either with Maven or Gradle in dev mode with hot reloading enabled help Display help information about the specified command. format formats code with Spotless init initializes Just related files build builds application kill kills process running on port just --help 0.80s user 0.07s system 97% cpu 0.897 total %
So if you wanted to write a CLI in Java but didn’t: Now’s the time! Just pick a Java framework that supports native Java, like Spring Boot 3, Quarkus, or Micronaut. And build it as a native executable with GraalVM.
To the Quarkus and Micronaut fans among my readers: I know you guys could build fast CLIs for years. But I hope we can all agree that Spring Boot 3 made native Java more mainstream. 😀 Hence, this news item appears now.
This Book Will Save IntelliJ Users Tons of Time
If you are an IntelliJ user, this book will save you a lot of time! Trisha Gee, the former lead developer advocate at JetBrains, and Helen Scott, the current lead developer advocate at JetBrains, wrote it together. Trisha covers the advanced users, while Helen dishes out tips for beginners.
So, how will this book make you faster? By focusing on three areas:
- Keyboard First
- Always Green
- Staying in the Flow
The book is on Leanpub and costs at least 30 dollars. Saving dozens, if not hundreds of hours in the future, this book is a no-brainer for IntelliJ users!
Interested? Then read the interview with Trish & Helen.
Better Debugging with Kotlin 1.8
I know, this is a Java newsletter. But what’s wrong with occasionally looking at the other side of the fence and seeing if it’s really greener? Which brings me to Kotlin 1.8, the latest release of the #2 language on the JVM. And this time, the grass is brown & muddy.
Why such harsh words? Well, let’s look at the list of new features:
- Better debugging by removing optimizations that mess with the debugging experience
- Built-in function for recursively copying and deleting directories
- Faster reflections
- Support for writing Gradle tasks with Kotlin for Gradle 7.2 (released August 17, 2021) and 7.3 (released November 9, 2021).
Does this grass look green to you? And the support for Gradle 7.2 and 7.3 is especially baffling to me: What took so long? These releases are more than a year old! And how do I write Gradle tasks with Kotlin in the current Gradle release, 7.6?
Kotlin 1.8 has more changes, but they don’t concern us Java developers (like improved interoperability with Apple’s Objective-C & Swift).