Java Platform, Standard Edition What’s New in Oracle JDK 9

[ ]

Java 9 has been release. Let’s check the most important updates:


The next release of Java will feature a new command line tool called jshell that will add native support and popularize a Java way to REPL (Read-Eval-Print-Loop). Meaning, say, if you’ll want to run a few lines of Java on their own you won’t have to wrap it all in a separate project or method.

Yes, Java is one step closer to Python.


Flow is the Java implementation of the Reactive Streams API, and we’re pretty excited that it’s coming to Java. Reactive Streams solve the pain of back-pressure. The build-up of data that happens when the incoming tasks rate is higher than the application’s ability to process them, which result in a buffer of unhandled data. As part of the concurrency updates, CompletableFuture will also get an update the will resolve complaints that came in after their introduction in Java 8. This will include support for delays and timeouts, better support for subclassing, and a few utility methods. See more information in Java 9 concurrency updates with CompletableFuture and java.util.concurrent.Flow.

Stack Walking

The second thing we wanted to mention here is the Stack Walking API. That’s right, Java 9 will change the way you traverse stack traces. This is basically an official Java way to process stack traces, rather than simply treating them as plain text. It will make debug much easier. See more information here

HTTP 2.0 is the future

The official HTTP 2.0 RFC was approved not too long ago, building on top of Google’s SPDY algorithm. SPDY has already shown great speed improvements over HTTP 1.1 ranging between 11.81% to 47.7% and its implementation already exists in most modern browsers.

Java 9 will have full support for HTTP 2.0 and feature a new HTTP client for Java that will replace HttpURLConnection, and also implement HTTP 2.0 and websockets. Another cool thing about this new API is that it’s going to be introduced as the first incubator module in Java. An incubator module is basically an experimental feature that will either progress to be adopted in the next version of Java, Java 10 in this case, or it will be removed. A pretty unusual concept for Java that would encourage experimentation without breaking backwards compatibility.

The process API just got a huge boost

So far there has been a limited ability for controlling and managing operating system processes with Java. For example, in order to do something as simple as get your process PID in earlier versions of Java, you would need to either access native code or use some sort of a magical workaround. Moreover, it would require a different implementation for each platform to guarantee you’re getting the right result.

In Java 9, expect the code for retrieving Linux PIDs, that was looking like this:

public static void main(String[] args) throws Exception {
    Process proc = Runtime.getRuntime().exec(new String[] {
       "echo $PPID"

    if (proc.waitFor() == 0) {
      InputStream in = proc.getInputStream();
      int available = in.available();
      byte[] outputBytes = new byte[available];;
      String pid = new String(outputBytes);

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

And now looks like this:

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

The update will extend Java’s ability to to interact with the operating system: New direct methods to handle PIDs, process names and states, and ability to enumerate JVMs and processes and more. This might not be too exciting for some but we at OverOps will probably make an extensive use of it so this is why we thought of highlighting it among the other features.


Written on September 22, 2017