JDK 11 · JSR 384 · Long-term support

Java 11

JDK 11 is Java SE 11, JSR 384, generally available on 25 September 2018. Vendors treat it as a long-term support release. The HTTP client leaves the incubator. Single-file source programs can be launched with the java command. Java EE and CORBA modules are removed from the JDK.

How to read the status

Language

Local-Variable Syntax for Lambda Parameters

JEP 323 · Final · Language

An implicitly typed lambda can write its parameters with var. That does not allow var on ordinary method parameters.

Local-variable var arrived in Java 10 (JEP 286).

OpenJDK JEP 323 (leaves JavaMastery)

APIs / Libraries

String and file helpers

Final · APIs / Libraries

String gains isBlank, strip, lines, and repeat. Files gains readString and writeString. These are library methods, not a separate language.

Related reading: Strings

Curriculum file: versions4Java9To11Features.java

Remove the Java EE and CORBA Modules

JEP 320 · Final · APIs / Libraries

Modules such as java.xml.ws, java.xml.bind, and the CORBA modules are removed from the JDK. Applications that used them need those libraries on the classpath or module path.

OpenJDK JEP 320 (leaves JavaMastery)

JVM / Runtime

ZGC (Experimental)

JEP 333 · Experimental · JVM / Runtime

ZGC is a low-latency collector. In Java 11 it is experimental, not the default, and not a finished product feature.

It becomes a product feature in Java 15 (JEP 377).

OpenJDK JEP 333 (leaves JavaMastery)

Related reading: JVM and memory

Tools / Platform

Launch Single-File Source-Code Programs

JEP 330 · Final · Tools / Platform

java Hello.java compiles and runs one source file. The source file still has to be a valid program for that JDK.

OpenJDK JEP 330 (leaves JavaMastery)

Deprecate the Nashorn JavaScript Engine

JEP 335 · Final · Tools / Platform

Nashorn is deprecated and marked for removal. It is still present in Java 11.

Removed in Java 15 by JEP 372.

OpenJDK JEP 335 (leaves JavaMastery)

Also in this release: nest-based access control (JEP 181), dynamic class-file constants (JEP 309), ChaCha20 and Poly1305 (JEP 329), and Unicode 10 (JEP 327).

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

Since Java 8, Java 9 added modules and Java 10 added local var. Java 11 standardizes the HTTP client and removes the Java EE and CORBA modules. That is a change in the platform, not a claim that one release is better.

Sources. General availability, JSR 384, and the JEP list: OpenJDK JDK 11. OpenJDK JDK 11 (leaves JavaMastery)

All versions