Java 9

What are the most exciting features that are expected to be released in Java 9? (Originally Published 17-Jun-2015)

Don’t get distracted by the relative silence around Java 9! The JDK committers are hard at work preparing the next release, which is expected to be generally available in September 2017. Early access builds are already out in the wild and we’re counting down the days for general availability on the Java 9 Countdown website.

Today we have a pretty clear picture of the features we can expect in Java 9. If Java 8 could be described as the major release of lambdas, streams and API changes, then Java 9 is all about Jigsaw, jshell, and a collection of under the hood and API updates. In this post we’ve gathered some of the features we believe are the most exciting ones that are targeting Java 9 – Apart from the usual suspect, project Jigsaw, which took on the mission of breaking down the JRE and bringing modularity to Java’s core components.

Java 9 is expected to revolutionize the way we think of and build large scale applications. Join the Java 9 First Impressions webinar and find out how.

Here some of the features which are an absolute must to know about in Java 9, some of these are already ready for you to tinker with in the early release version.

1. Java + REPL = jshell

Yes. Previously we had doubts that project Kulla would make it in time for Java 9 but now it’s official. 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. Oh and semicolons – you can forget about those:

There are some alternatives like REPL add-ons to popular IDEs and solutions like the Java REPL web console, but no official and right way to do this so far. jshell is already available in the early release and waiting for you to give it a test run.

2. Noteworthy API Updates: Concurrency and Stack Walking

As part of the update to this post, we wanted additional features we’ve covered extensively after the publishing of this post.

The first thing we want to mention here are the Java 9 concurrency updates with CompletableFuture and java.util.concurrent.Flow. 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.

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 also kind of sounds like a vague Star Wars reference. Which made us like it even more!

3. G1 will be the new default garbage collector

A common misconception we often hear is that Java has only one garbage collector when in fact it has 4. Prior to Java 9,  the default garbage collector was the Parallel / Throughput Collector, and now it will be replaced with G1 which was introduced in Java 7. For a bite sized overview about the differences between the collectors, you can check out this post right here.

Generally, G1 was designed to better support heaps larger than 4GB and has been known to cause less frequent GC pauses, but when a pause do comes, it tends to be longer. We’ve also discussed all things GC with Haim Yadid, head of performance at Next Insurance, to help you learn more about the different trade offs between the collectors.

Find the Crap in Your Java App

Show me how >>


4. 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.

5. 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 now looks like this:

To turn into something like this (that also supports all operating systems):

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.

6. Debugging in Production

While not exclusive to Java 9, we thought this post would be a good opportunity to share some of the new progress we’ve been making. Solving errors in production has always been a messy practice, grepping for clues over huge log files, and trying to identify the state that caused each exception or logged error. But what if you could avoid logs altogether? Here’s how it’s done.

Many Java developers who were checking it out had quite a few questions about the tool, so we’ve also set up this form for 1 on 1 demos, check it out and schedule to schedule a personal walkthrough.

What you’ll not be seeing in Java 9?

Two interesting features that we assumed will make a part of the upcoming Java release – but now we know they will be skipped this time are.

1. A standardized lightweight JSON API

On a survey we conducted with 350 developers, the JSON API was just as hyped as Jigsaw but looks like it didn’t make the cut due to funding issues. Mark Reinhold, chief architect of the Java platform, on the JDK 9 mailing list:

“This JEP would be a useful addition to the platform but, in the grand scheme of things, it’s not as important as the other features that Oracle is funding, or considering funding, for JDK 9. We may reconsider this JEP for JDK 10 or a later release. ”

2. Money and Currency API

In other news, it also looks like the expected Money and Currency API is also lacking Oracle support. This is the answer we got from Anatole Tresch, the APIs spec lead:

3. As part of the update to this post, we thought it’s also worth mentioning Project Amber. A project that’s targeting future Java versions, beyond Java 9. Read more.

Did we miss anything? Let us know in the comments below.

Some kind of monster @ OverOps, GDG Haifa lead.
  • Lukas Eder

    The irony in #5 is that using the low-level InputStream API is still such a PITA in standard JDK API 🙂

    • magicsign

      pita and falafel ?

      • Xavier

        no, pita and katniss !

        • Alex Zhitnitsky

          I should follow up on comments more often, this is pure gold 🙂

  • Jake Schwartz

    Surprising that a standard JSON library is not going to be included, with that being one of the more popular ways to send data these days via APIs.

    • Alex Zhitnitsky

      Looks like we’ll keep relying on 3rd party libraries, at least until Java 10 if JSON will remain popular 😉

  • Binh Thanh Nguyen

    Thanks, nice post

    • Alex Zhitnitsky

      Thanks Binh! Glad you liked it

  • Adrian Bartlett

    The REPL looks good for prototyping. I often write new code in the debugger, so I can access the current application state. I hope there will be IDE integration, provided by the vendors.

  • saasira

    can we load the jshell into linux shell like #!/usr/bin/jshell and run our java/jshell scripts from the terminal? or these scripts need to be run by jshell alone?

    • Alex Zhitnitsky

      JShell is a command line tool, you run it from the terminal, and it also allows you to save the code you typed in and load it again through JShell. Spoiler alert: We’ll be publishing a post soon covering JShell, so stay tuned 🙂

  • Alvaro Urbaez

    Why is so hard get native JSON support?? Uh.. 🙁

    • Alex Zhitnitsky

      With so many 3rd party libraries doing a good job, it seems like a lower priority at the moment. The expectations from native library support are definitely higher though, and the feedback we’ve seen from the community shows that many developers want to see that in the near future. Guess we’ll have to wait for Java 10, or 11, or 12 😉

  • Valaki2

    Most of those things are not very important in my opinon. Most of the functionalities could be achieved using external libraries (like http2) or are simply minor. I would be more interested in new language elements….


    Is it just me or it is quite a boring list of updates for a major version upgrade?

  • Caleb Cushing

    well at least we’re getting jigsaw, I’m now kind of interested in what will be coming in 10, since lambda’s and jigsaw seemed like the big thing. I’m sad that Money isn’t getting any.

  • Nissi T

    wasted 10 minutes of my time reading this, are you kidding developers. whats up with this whole boring list of features in a major release, we are in 2016 guys

  • Randy Pancetalk

    What a shame. Native JSON support would be vastly more helpful than some java shell or Microbenchmarks. The microbenchmark system already exists as a standalone API.

    Guess the java architects are out of touch with how people are using java.

    • Caleb Cushing

      funny, I was just thinking how with Jackson I don’t actually need JSON in core, in fact I’ve never had a problem with lack of JSON in core, but a REPL? I want a good REPL at least once a month.

      • Jacob Beasley

        Agreed, with good IDE integration I wonder if you could not just do a breakpoint, but actually execute code in your breakpoint from a console. I mean, that would be great for debugging and trying things out stand-alone.

  • gacl

    Instead of native JSON, I’d prefer what Python has: super clean list and dictionary/map syntax with simple one-line conversion to/from JSON text. Preferably with list/dict comprehensions.

    Most of these features are quite tiny or petty. The one big one is Jigsaw, I’m not sure how good or bad that will be. A native REPL is nice. Tons of other minor updates. Hopefully Jigsaw will benefit Scala too.

    Project Valhalla has high-performance immutable value types, which is very important. That is already well in development and I presume it will be JDK 10.

  • slidenerd

    well honestly i was expecting java to cut short code like Swift, lets see if they go in that direction anytime soon

  • download13

    Does that popover need to be bothering us while we try to read? It makes for a kind of unpleasant experience.

    • Stefan Schenk (Menzies)

      Yes, I will never visit this site again. And I closed the popup under 1 ms.

    • Stephen Crowley

      same here. fuck this site

  • Ram S

    I think Java is missing the point and not focusing on language feature development… As someone pointed out these features are not that important (except REPL which is cool)… What about speed, compilation, unsigned numbers, etc… that is more prevalent and getting popular in other languages… and may be AI? IOT enabled etc..

    • gacl

      JDK 8 added unsigned integer functions to the standard library in java.lang.Integer. These are inlined and the JVM will run at full native performance. This solves 99% of the need for unsigned integers.

      • sanosuke001

        the Integer unsigned methods really don’t help; try working with wrapped native libraries like OpenGL.

        • gacl

          I haven’t used OpenGL or other native libs from Java. But the unsigned integer functions do give you performance benefit for regular Java ecosystem code working with unsigned ints.

          Better FFI with C-based “native” code is coming in Project Panama (JDK 11?)

  • Carlos Daniel Cañón Carrero

    Well, think this isn’t much important.
    Anyway, the jdk8( and Lambda was amazing upgrade), but actually i am working with Scala, if you wanna have more productivity try learn this language, this run on the same JVM.

    • gacl

      JDK and JVM features benefit Scala too. The main purpose of Scala 2.12 is to take full advantage of the JVM improvements in JDK 8. Jigsaw in JDK 9 will definitely impact Scala and hopefully provide large benefit. Project Valhalla value types in JDK 10 will be of huge benefit to Scala and any other JVM language.

  • Paul Bartlett

    I think this has proven how little love Oracle have for Java. As many have mentioned, none of this is enhancement to the core language. Compare C# to Java with features such as implicit typing, property definitions, null coalescing, string interpolation, partial classes, tuples, multiple return types (C# 7), LINQ, object initializers etc. I was hoping Java would kill the need for Groovy, but Java is an embarrassingly 1990’s language. Where is the stuff that makes programming exciting. Java is the most boring modern language. Whilst C#, Swift, Javascript, Python are all innovating, Java has lost it and I can only see it lose it’s crown in the next few years.

    • fcassia

      Why does everything have to be a horse race?. What about maturity? What about not changing the syntax for change’s sake? Does C change syntax all the time? Sometimes NOT CHANGING for change’s sake is a feature. Also, the beauty of Java is that is MORE than just a language, it’s also a level playing field software ecosystem and runtime. So you get things like KOTLIN language, or RedHat’s Ceylon, or JRuby, or GOLO, or -insert-your-JVM-language-here. So you can use all of the JVM features WITHTOUT having to write a single line of Java code.

    • gacl

      In the JVM ecosystem, the Java language is supposed to be the safe, conservative language with extremely high backwards compatibility at both source/binary level. It is not intended to be feature competitive. Use Scala if you want fancier features in the JVM space. Note that Scala forfeits backwards compatibility. 2.12 is completely binary incompatible with 2.11 and there are modest source code level incompatibilities too. Scala Dotty will have larger source compatibility changes, and that makes sense for Scala. C#, is in the middle, in terms of backward compatibility and in terms of features.

      I’d also comment that:

      Multiple return types: Good tuples are probably the best solution to this issue.

      Tuples: Scala has very nice anonymous tuples and named/typed tuples (which they call case classes). C# is planning support for native anonymous tuples in the future, but AFAIK they still doesn’t have them.

      LINQ: This is basically a Microsoft branded version of standard functional collections operations: filter/map/fold. This functionality is in Java 8+ as well as every other mainstream language.

      partial classes: IMO, this isn’t a desirable feature. This is where you can define part of a class in one file and other part elsewhere. It was made to assist some Microsoft frameworks designed around IDE tools that auto-generated some of the code in a class. IMO, that style of auto-generated code says either there is a bigger problem in the language or the framework.

      • Anthony Plant

        LINQ is a great deal more than that.

        • gacl

          LINQ is functional collections operations, an optional custom syntax, and database integration features. That’s pretty much it. Can you name anything else?

          • Anthony Plant

            The “functional collections operations” that you’re talking about are not LINQ, they are one small set of extension methods packaged as a tiny part of LINQ, which itself is a much greater suite of tools that allow you to build dynamic expression trees which can be manipulated and traversed at runtime and interpreted to query operations for any system that cares to supply a provider. Calling it “Microsoft’s filter/map/fold” is kind of ludicrous.

          • gacl

            The LINQ examples given in official MSDN docs are pretty much all filter/map/fold and also join, sort, selectMany (flatMap) and common math functions, etc. I feel like you are deliberately making this more complicated than need be. All programming language compilers generate expression trees that are used at runtime. Can you link an example that showcases LINQ functionality beyond various the other multitude of functional collections libraries out there?

            Here is the official LINQ example docs:

      • Alex Zhitnitsky

        Hey! We’ve recently wrote about C# features we’d like to see in Java. Thought you’d like to take a look:

    • Mil Yan Magnusson

      The way people respond to your post makes me feel like I am reading about FORTRAN and COBOL and other grandpa’s languages. Its not sexy but its wool socks keep the feet warm 🙂 🙂
      Btw, gacl, LINQ is not just functional collections operator, its just one narrow function it has. Its the universal enumerable operations language, it can compile to an expression tree which 3rd party providers can (and do) convert to native acquisition code, I can run it against a database, but I can also run it against my custom dataset source if I invest the time to build a provider. As far as I know, no language has this at this point.

    • Anthony Plant

      Proper async support?

    • HaakonKL

      But properties is solving the wrong problem. What you really want is a compiler macro facility, preferably something that integrates well with tags.
      String interpolation already exists: String.format(“%s It’s a form of string interpolation!”, “Guess what this is!”); and if you want it in a nicer format, there’s probably some library out there for it. And if it isn’t, you could have had it, if you have had COMPILER MACROS.

      I mean, we could go on, but what you really want is the ability to hook the compiler. And that’s a good idea, but you don’t really want properties and string intepolations, you want the ability for someone (Apache Commons, Google Guava, Joda-stuff guys) to write that library, and after a long time when we all agree on how it should be done, it can migrate to the standard library.

      That would be a much better state of affairs than what we currently have.

  • gacl

    Wow, these features are lame. This article is over a year old an no updates? Consider #2: I like the jmh microbenchmark system, but bundling it with the jdk versus being a separate add-on is small potatoes.

    • Alex Zhitnitsky

      Hey! We’ve just update the article. Thought you’d like to take another look. Lots of new stuff has been announced since the original date of the post so we thought it would be a good time for an update, just before the schedule date of the release.

  • sanosuke001

    I’d rather see unsigned primitives

    • Basil Bourque

      FYI, as of Java SE 8, there are a few new methods in the Integer class which allow you to use the int data type to perform unsigned arithmetic. See this Answer on Stack Overflow:

  • Pranas

    Looks like 0 future for UI in Java …

  • Clinton Selke

    Units of Measure API? I thought it was promised for Java 9 too, but I could be wrong.

  • Andrea Palmate’

    unsigned types would be appreciated………….

  • Cristian Ariel

    Hey !! where’re my language improvements here ?? i need to shut these kids up yelling out about RoR this and that… we also need old C coders take the pill and go to sleep now… so lets stop becoming Rails and adding silly features to the SDK instead of updating THE LANGUAGE, that is WHAT WE ALL NEED. I got surprised and refreshed with J8 I saved lot of hope to J9 … so naive of me…

  • Javier Sainz

    Reactive Streams implementation

  • HaakonKL

    I don’t really think that adding libraries like Money etc. is that great of an addition: You can still use the library after all.

    that I heard talk about that I would really love to see would be a
    redoing of generics with reification for primitives and safe casting for
    objects. Because being able to write Map
    conversionTable = … would be amazing.

  • Matthias Hryniszak

    I wonder… Java is the last of the mainstream languages to still not feature map and list literals. Everyone else has it. Was that part of the jigsaw project that’s been deemed not so important?

  • scvblwxq

    How about an array type that starts with one instead of zero. That would be really useful for all of the the applications that involve counting things and having zero things is not valid.

  • big26

    A standardized lightweight JSON API
    never too late !

  • Basil Bourque

    The item “2. Microbenchmarks are coming” did *not* make it into Java 9. See the [list of projects in Java: “JEP 230: Microbenchmark Suite” is not in that list.

  • Natalie Orlovska

    For me, the most anticipated feature of Java 9 is Jigsaw project which introduces a new module system that breaks the JRE into interoperable components.
    As it is said in Java 8 Vs. Java 9 article ( ), with a modular JRE, applications will be enabled to run on even embedded systems. This is an especially huge change in the context of the advent of Internet of Things (IoT). It carries forward Java and it means we have a chance to have a big number of IoT apps written in Java.

  • Jesper de Jong

    This article is from 2015, and unfortunately a few months ago it became clear that the HTTP 2.0 client is not going to be included in the standard API – it will be there only as an experimental (incubator) module. Which means that you will not want to use it in production software.

    Ref.: which says:

    The API will be delivered as an incubator module, as defined in JEP 11, with JDK 9. This implies:

    * The API and implementation will not be part of Java SE.
    * The API will live under the jdk.incubtor namespace.
    * The module will not resolve by default at compile or run time.

    • Alex Zhitnitsky

      Hi Jesper! That’s correct. We’ve just updated the post. Technically it will be available as part of Java 9 though. We’re pretty excited about the incubator namespace in general, it’s like a new ground for experimenting with Java.

  • Binh Thanh Nguyen

    Thanks, nice post

  • Charvis Yang

    Why does Java still stick to the compatibility so that they are not dare to change a lot in Java syntax and JVM? Java can have an incompatible version like Java 10, and advance the language. The pain is temporary, but it is absolutely worth. Python did that,, I really don’t like learning too many new language just run on JVM for better syntax and lean language, , Scala, Kotlin, .. Why doesn’t Java evolve with greater steps?

    • jarif

      I have been lately maintaining Java code that was originally started from 30 years ago. It still evolves and grows, but still has (more or less) unchanged code from the origins. 2.5 million lines of code.

      We currently run it on Java 8 and I use lambdas etc, but I would not like to see Oracle breaking the old code thank you.

      I use Kotlin for newer projects and that’s all good.

  • saksham agarwal
  • Sreekanth Nair

    There is nothing so exciting, Java 8 was a kickass release, they could improved on lambda instead of all these useless features.

  • saksham agarwal

    You missed one important member — MULTI RELEASE JAR — you can refer here and update

  • saksham agarwal

    Actually you missed a lot of features. Read more and update. Thanks. I find this ( ) nice post