JDK 9 · JSR 379

Java 9

JDK 9 is the reference implementation of Java SE 9, JSR 379. General availability was 21 September 2017. The module system is the large change. jshell, collection factories, and process-API updates are the everyday ones. The HTTP client in this release is an incubator API, not the standard client.

How to read the status

Language

Milling Project Coin

JEP 213 · Final · Language

Small language follow-ups, including private interface methods, the diamond on anonymous classes, and try-with-resources on effectively final variables.

OpenJDK JEP 213 (leaves JavaMastery)

APIs / Libraries

Stream additions

Final · APIs / Libraries

takeWhile, dropWhile, and a new iterate overload arrive on Stream. The shared example collects with Collectors.toList(), which already existed in Java 8. The whole file still requires Java 11.

Related reading: Streams and Optional

Curriculum file: versions4Java9To11Features.java

HTTP/2 Client (Incubator)

JEP 110 · Incubator · APIs / Libraries

An incubator HTTP client ships in jdk.incubator.httpclient. It is not a supported standard API in Java 9.

Standardized in Java 11 by JEP 321 as java.net.http.HttpClient.

OpenJDK JEP 110 (leaves JavaMastery)

Related reading: Networking and HTTP

More Concurrency Updates

JEP 266 · Final · APIs / Libraries

java.util.concurrent.Flow publishes the reactive-streams interfaces. CompletableFuture also gains more composition methods.

OpenJDK JEP 266 (leaves JavaMastery)

Related reading: Concurrency

JVM / Runtime

Tools / Platform

jshell

JEP 222 · Final · Tools / Platform

jshell is a read-eval-print loop for Java statements and expressions. It is a tool, not a library you import.

OpenJDK JEP 222 (leaves JavaMastery)

Multi-Release JAR Files

JEP 238 · Final · Tools / Platform

One JAR can contain class files for more than one Java release, so a library can use newer APIs where they exist.

OpenJDK JEP 238 (leaves JavaMastery)

The OpenJDK JDK 9 page lists many more JEPs, including the modular JDK image (JEP 220), compact strings (JEP 254), and the stack-walking API (JEP 259). Those are not separate lessons here.

Examples

  • versions4Java9To11Features.javaCumulative Java 9–11 example · Requires Java 11List.of and takeWhile are Java 9. var is Java 10. The String methods are Java 11. The whole file requires Java 11. It uses Collectors.toList(), not Stream.toList().

Related reading

Historical notes

The module chapter teaches how modules work. This page only records that they became part of the platform in Java 9.

Sources. General availability and the JEP list: OpenJDK JDK 9. JSR 379: Oracle Java SE specifications. OpenJDK JDK 9 (leaves JavaMastery)

All versions