How have Java SE releases changed?
Choosing a Java SE version used to be fairly straight-forward. For about 12 years, you went with Java6! In recent years, things have changed, and we now have a new Java SE release every six months…
What does this mean?
Firstly, this is a good thing. It means that the Java language can move forward in a world where speed is essential. You will not see massive changes to Java but you will see a faster response time to the changes happening in the IT world. Java9 was released in September 2017 and now we have Java10 in March 2018.
The first thing to appreciate is that these Java releases are different from the older type of releases. Because they are far more frequent, they will contain far less in terms on new features. So each release will be generally more incremental with one or two headline features.
Secondly, not all releases are created equal. Some will be long-term releases, supported for years to come, while others will be short-term releases, effectively killed off with the release of a new version after 6 months. Long-term releases will be supported for much longer with security updates but will still be eventually unsupported.
Thirdly, the releases will still be generally backwards compatible. There is nothing to stop you using Java10 on your machine, but writing code which is still able to run on Java8 and Java9. You only lose this if you add in language features introduced with a new Java release (such as the var keyword in Java10).
Some new features may be backwards compatible. For example, Java9 introduced some new module features for Jigsaw which Java8 will ignore. So you can start writing modules but (with care) still support users on Java8. Java9 also added a feature to allow you to ship jars with TWO Java versions. This also works with Java8, which ignores the second version. So you can have a jar to support Java8 and another version. If Java9 or 10 provides you with some critical new features, you can ship 2 versions of the code.
How do I choose a Java version?
If you are starting to write some new code from scratch (with no constraints on what JDK you will need to support), you can use the latest Java release, but probably want to fix development on the first long-term release (ie Java11).
If you are writing a product which other developers will use or code which will be in production for some years, it makes sense, if possible, to target the latest Java term release. Currently this is Java8 which represents a good compromise on having a modern and supported Java release which the majority of Java users will be able to use. You can still develop on newer Java releases (and it probably makes sense to ensure you test on them), so long as you set the code level to Java8 in your IDE.
If you are staying on Java8, you probably still want to be aware of what changes are introduced in later Java versions and when the next long-term release will be available. You can then incrementally do some of the work now (Like adding jigsaw support) so you can easily move to Java11 when it becomes available.
Oracle has a nice roadmap here. Which version of Java will you be using in March 2018?
Latest posts by Mark Stephens (see all)
- Introducing the new XFA Parser in FormVu - May 16, 2018
- Moving to JPedal release 8 - May 2, 2018
- Which version of Java SE should I use? - April 25, 2018
- How we are improving our code quality with IDEA in 2018 - March 7, 2018
- How we are improving our code quality with NetBeans in 2018 - March 1, 2018