Java SE 9 First Look

Oracle has finally released Java SE 9, now available on the Oracle Technology Network. As usual the official end-user portal java.com will switch versions later, so for now it still distributes Java SE 8u144. I have yet to install the JDK, as the corresponding NetBeans update was delayed by its transition from Oracle to Apache. Nevertheless, I discovered some noteworthy changes in the release documents and distribution packages, including a few unexpected but welcome ones.

Module System

The principal change (and cause for Java 9’s delay) was of course the new module system, code-named “Jigsaw.” There are about five million articles already written on this subject, so I just direct you to Mark Reinhold’s release post with tons of links for further reading.

For anyone building less-than-gigantic applications, such as the JDK itself, Jigsaw is not directly relevant. The existing simpler package format works just fine, and is of course fully supported, aside from some fairly arcane compatibility issues with complex projects. However, Jigsaw does facilitate a new linker for selective JRE redistribution:

As a result you can now deliver a Java application together with a slimmed-down Java run-time system that contains just the modules that your application requires.

I’ll be sure to try just how small a fully self-contained Java or JavaFX application for Windows might be. This is potentially very useful for distributing client applications, as not many people have Java installed these days (or an outdated version).

Documentation

Oracle’s online documentation has been completely overhauled and reorganized. The old architectural overview diagram with its confusing jumble of links is happily gone. (It’s now also gone from the Java 8 documentation but you can still see it for Java 7). While you’re there, don’t forget to download the new PDF specifications for the Java language and virtual machine.

The API specifications (= JDK Javadoc) got a new and very useful search box, and are as usual available for download and offline browsing at the Oracle Technology Network. There’s only one download: the JavaFX documentation has finally been integrated with the rest of the JDK, rather than sitting around alone like some red-haired stepchild.

System Configurations

If you’ve looked at the JRE/JDK download pages, you may have noticed that the 32-bit versions for Linux and Windows are gone. And indeed, the updated Certified System Configurations no longer list any 32-bit configurations. For Windows this is actually quite important, because the 32-bit JRE on Windows (the java.com default on that system!) inexplicably had only the slow and obsolete Client VM. Now Windows users no longer have to jump through hoops to get the same Server VM as other systems.

Moreover, applet support has been removed from Firefox in addition to Edge and Chrome, and the Java browser plugin itself is now deprecated and disabled by default. This is all wonderful and means my old Oracle Java on Windows advisory no longer applies to Java 9.

High DPI for Swing/AWT

Swing/AWT on Linux and Windows finally got the same automatic display scaling on high DPI displays that JavaFX already had for a while. I briefly tested it at my 200% display scale, and it seems to work just as well as in JavaFX. AWT also got multi-resolution images and TIFF image support, and there was some necessary refactoring due to the new module encapsulation.

Ironically, this is somewhat bad news for JavaFX (which got no new features). Lack of high DPI support was the most compelling reason to rewrite an existing Swing application in JavaFX. Now I expect we’ll still be using old Swing applications in 2100…

Everything Else

The total list of changes is as usual massive, although most are minor. JDK 9 Documentation links to all the more or less detailed sub-documents. I recommend you start with the What’s New overview, or alternatively the compact list of JDK 9 JEPs.

One significant addition is the JShell read-eval-print loop which should be quite useful to experiment with unfamiliar classes. Strings that only use ISO-8859-1 (Latin-1) characters now have a compact representation to save memory. The Java language itself got only some tiny changes, the most significant of which are probably private interface methods.

Much greater changes to the Java language are expected in the future, including custom value types and generics over primitives. It’s unclear when exactly these will happen as Oracle also announced a new scheme for releases, versioning, and licensing. Hopefully this means we’ll get them faster than the usual 2-3 years between major versions.

One thought on “Java SE 9 First Look

  1. Pingback: Java SE 9 First Look – Full-Stack Feed

Leave a Reply