Updated on 25th September 2019
The official release of Java13 was last week while we were also attending Oracle’s CodeOne conference. Having attended lots of talks and spoken to many other developers, I have updated our article below.
Choosing a JDK to base your code on used to be so much easier when there was a new Java release only every decade or so… Now we get a new version of Java every six months. So which version should you use?
The first thing to understand is that not all JDK releases are created equal. Some of them are Long Term Releases (which will be supported for years to come) and others will be replaced after six months by Oracle (although other companies may offer longer term support). Long Term Releases are Java 8, Java 11 and Java 14, while Java 9, 10, 12, 13 are short term. Official end of support dates are on the Oracle website.
Later releases contain lots of features, which make it much easier and quicker to write good quality code. So there is a classic trade-off between new features and backwards compatibility.
So here are our personal suggestions…..
We need to write code which needs to use lots of legacy libraries and needs as few changes as possible
- Stick to Java 8 if you are really paranoid but otherwise move to Java13/14. Even if you stick to Java8 code level, try to use the Java 13/14 JVM. Speed for lambda is much improved in recent releases.
- We are starting a new project and want to get all the benefits of modern Java but need some stability.
- Use Java 13/14 and standardise on Java 14 when it is released. You get all the benefits of Lambda, streams, jigsaw, faster JVM and years of support.
We are starting a new project and want to get all the benefits of modern Java but development will take some time before we need to standardise
- Use Java 13 and aim to stabilise code use on Java 14 . You get the latest version of Java with a good long-term support timetable.
Do not use old short-term releases (Java 9, 10, 12) unless you have very specific use cases.