Thursday 11 May 2017

The latest on Java 9... will it be delayed, features removed, or released with problems?

In case you’ve not been following the progress of the next release of Java SE,  Java 9, we thought we should let you know what the current status is (or at least our current understanding of it!).

As you might expect, the next version of Java will have some changes in it from the earlier versions. By far the biggest, is the introduction of Jigsaw, an API for building modular applications. Some have described this as a bigger change for Java than when generics were introduced back in Java 5.

If you’re not familiar with modular applications, then in simple terms the idea is that you can split larger applications into smaller parts (modules). Each module can depend on / use other modules, but they’re built as separate projects, and compiled into separate Jar files. There are quite a few potential benefits to this approach, but perhaps the most useful is that if you need to change a single module, you can do that without needing to amend or recompile any of the other modules. There's more to it than this, but that's a very simple high level overview.

If this sounds familiar (you may be thinking about microservices) well it’s another way of solving the same problem that microservices solves, at least in terms of building smaller, more manageable applications rather than monoliths.

Actually if you have a need for modular Java right now, then you don’t need to wait for Jigsaw – the OSGi framework (https://www.osgi.org/) provides this today, and although I've never used it personally, everyone I have met who has say it works well. Unfortunately Jigsaw isn’t compatible with OSGi… I guess there are some politics involved as to why they didn’t adopt OSGi as the standard!

So that’s the background… what’s the current status?

Well Jigsaw is having some problems. I have tried using it myself, with the current beta release of the Java 9 JDK. I thought it might be an interesting and useful exercise to take an internal Spring Boot based application that we use at Virtual Pair Programmers, and upgrade it to make it modular.

Unfortunately I ran into some problems doing this, including:
  • Maven doesn’t work with Jigsaw right now. So if you want to build a set of modular Spring Boot applications, for example, well it’s possible in theory but highly frustrating in practice…. it involves writing a number of shell scripts and delving into the file system to work out where all the maven dependency jars have been put, so that you can reference them in your compilation scripts.
  • Eclipse doesn’t really cope well with Modular projects right now. It can be used to edit them (although you’ll do some frustrating manual moving around of the file structure to get it to work) but you can’t currently create a modular Jar / War file from Eclipse. Again you'll end up writing shell scripts to do these. We understand that other IDEs have similar issues.


This means that today, Jigsaw is really not ready for use.  We recently attended the London Java User Group’s hackday to get an introduction to Java 9, and certainly left there with a feeling that the modular approach is going to take some getting used to… and without full integration with familiar build tools and IDEs, it won’t get widely adopted. 

It seems that more widely within the Java community our view that Jigsaw isn’t ready is shared… and not just for the reasons we have come across. Currently 13 of the 23 organisations that have a vote on the Java Committee have voted no to Jigsaw being ready to release (https://jcp.org/en/jsr/results?id=5959).


Currently Java 9 is scheduled for release on July 27 2017. Whether it gets delayed, it gets released without Jigsaw, or the Jigsaw issues get sufficiently fixed in time, we’ll have to wait to see!

No comments:

Post a Comment