2 minute read

Java has been going through many changes recently. Superficially, the versioning approach has changed to follow a new 6-month release cycle. This new release cycle is not like the big bang prior Java releases. Each 6-month release immediately deprecates the previous version. The Oracle support roadmap details all these changes.

The first long-term support (LTS) version will be Java 11. On September 25, 2018, JDK11 will be released hence the 18.9 version number.

Two new Garbage Collectors

You can experiment with the first one right now by downloading the early access JDK11 build.

By default, JDK11 uses the G1 GC. Notice how for a small 4 line program it still performs some GC actions.

The code makes an HTTP GET request to www.google.com.

However, the new Epsilon GC is non-reclaiming. A GC system is still needed to allocate the memory, but this GC does no reclaiming of memory. Instead, when the system exhausts its memory, it throws an Exception.

The same code run using the new Epsilon GC.

The other new GC is named ZGC/JEP333 and is very experimental and has some glaring limitations. This feature must be enabled during the compilation of the JDK. Since I don’t want to compile my own JDK, I leave the reader to read about this GC.

Single-file source-code programs

You probably noticed some strange Java command line usage above; that was not a typo. The Java command now supports running a single Java file without javac and the resulting class files. This feature is an excellent bridge between jshell and a full build like Gradle or maven.

New HTTP Client

In Java 10, this new HTTP client was in incubator status, but in Java 11 it graduates to the java.net.http module. Look again at the conciseness of this HTTP code that before this addition would require an external library like Netty or much more verbose standard library code.

Flight Recorder moving from commercial to OSS

This tool has been around for a while, but you needed to download the Oracle JVM to use it. Now it’s in the OpenJDK as OSS. Flight Recorder powers the Java Mission Control.

Deprecating JJS

JEP335 will deprecate the Java-based Javascript engine named Nashorn. I guess it wasn’t worth their time with the success that Node.js is enjoying.

Deprecation of Pack200 tool

JDK11 integrated JEP336. The change is a deprecation message when using the pack200 tool. Below are examples of calling the program in JDK10 and JDK11.

JDK10

[~] /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home/bin/pack200             5:46:10
Usage:  pack200 [-opt... | --option=value]... x.pack[.gz] y.jar
(For more information, run pack200 --help .)

JDK11

[~] /Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home/bin/pack200                 5:46:14

Warning: The pack200 tool is deprecated, and is planned for removal in a future JDK release.

Usage:  pack200 [-opt... | --option=value]... x.pack[.gz] y.jar
(For more information, run pack200 --help .)

The new release model for Java will require consistent upgrades or big jumps from LTS versions. The incremental changes every six months are far less painful than big version jumps. This post isn’t everything that’s happening in JDK11. If you want to see it all in greater detail, please go over to the JDK11 project on OpenJDK.

Updated: