After some delays, Java 9 should be released in March 2017 with a lot a various new features. In this article, we let you to discover the Top 5 of new features expected with Java 9.


1. Java comes modular with Jigsaw

Expected since Java 7, the project Jigsaw should become a reality with Java 9. Main goal of Jigsaw is to make the JDK modular and so more scalable. Jigsaw must let to developers to build optimized Java applications to target small devices. To achieve this, Jigsaw brings a complete modular system to Java. It must mean the end of the “Classpath Hell” too. If should take some time to developers to master the new modular system but with Jigsaw, Java goes in the good way.

2. A new Process API

The actual Process API will be improved with Java 9 to give more features to developers. You will be able to list system processes and get some properties about them like the process id, process name or still process state. The API lets developers to get these info for each systems where Java runs. For example, to get current process id, you could use the new Process API like that :

System.out.println("Your pid is " + Process.getCurrentPid());

3. Java gets its REPL

Where as some other languages had already their own REPL (Read Evaluate Print Loop), it’s now time for Java to get its own REPL called JShell. It will evaluate declarations, expressions and statements directly on the command line. The ideal tool to help beginners to discover the language or even for the Java experts to discover new libraries for example. JShell will provide an API available for other applications.

4. An HTTP/2 Client

The HTTP/2 standard is the new version of the HTTP protocol. Where as Java has had support for HTTP since version 1.0, the Java’s support was designed around a relatively protocol-agnostic framework with the URL class at the center. The new API coming with Java 9 makes a clean break with the past and abandons the attempt to maintain protocol independence. The API focuses solely on HTTP and stays independent from HTTP version. With the new API, a simple HTTP request will be like that :

HttpResponse response = HttpRequest
   .create(new URI(""))

int responseCode = response.responseCode();
String responseBody = response.body(asString());


With Java 9, you could say bye bye to Apache HttpComponents library.

5. G1 becomes the default Garbage Collector

Actually, the Parallel GC is the default  Garbage Collector for the JVM. With Java 9, G1 will replace it. While Parallel GC was throughput-oriented, G1 is optimized for minimum pauses. It should minimize the overall latency of the applications.