Live data from Hacker News

Which version of JDK should I use?

whichjdk.com

41–50 of 258 posts

Re: Which version of JDK should I use?

#41
post #23

The general guidance is always use the last LTS release unless there is a specific feature in the non LTS releases that you can’t wait for. So any new development should target 17 at this point. Unless you want serious long term pain then you shouldn’t be more than one LTS release behind. So if you are not running on JDK 11 or later you should be strongly thinking about upgrading.

Why should I stick to LTS? All other versions aren't in any way less tested, you should always stick to the newest released JDK version, be it LTS or not, this way you get all the benefits (language features, performance gains) and security ones (security fixes always first land in the newest version, and are backported to the older ones). Upgrades now are pretty straightforward if you are past JKD 9 - with JDK 16-17…

> (language features, performance gains)

There haven't been any notable language features added since java 9 besides some basic syntax sugar (which is already covered by stuff like lombok anyway).

For features and performance you might as well just target .NET 6. It has things that have been perpetually 'too hard to implement' (read: oracle doesn't want to pay their engineers to impl it and will sue you if you do it yourself) like value types, generics without type erasure, no checked exceptions, etc. and with .NET 6 performance is better than OpenJDK across the board.

Re: Which version of JDK should I use?

#43
post #23

Earlier quoted context omitted.

Why should I stick to LTS? All other versions aren't in any way less tested, you should always stick to the newest released JDK version, be it LTS or not, this way you get all the benefits (language features, performance gains) and security ones (security fixes always first land in the newest version, and are backported to the older ones). Upgrades now are pretty straightforward if you are past JKD 9 - with JDK 16-17…

> (language features, performance gains) There haven't been any notable language features added since java 9 besides some basic syntax sugar (which is already covered by stuff like lombok anyway). For features and performance you might as well just target .NET 6. It has things that have been perpetually 'too hard to implement' (read: oracle doesn't want to pay their engineers to impl it and will sue you if you do it…

any references/benchmarks for some realworld apps/services? and also what do you mean by oracle suing if you implement value types?

Re: Which version of JDK should I use?

#44

The general guidance is always use the last LTS release unless there is a specific feature in the non LTS releases that you can’t wait for. So any new development should target 17 at this point. Unless you want serious long term pain then you shouldn’t be more than one LTS release behind. So if you are not running on JDK 11 or later you should be strongly thinking about upgrading.

The safest, cheapest choice for applications that are heavily maintained is to use the most recent version. LTS is designed for legacy applications that are no longer heavily developed, and might benefit from security and bug fixes only (note that this model is new; in the past, back when there were major versions, minor updates included both patches and big features).

Re: Which version of JDK should I use?

#45
post #2

For those of us supporting more than a few legacy apps, use the oldest version (7 in our case) because then there's less chance of things going wrong (depends, of course, whether you bill per support call or a fixed annual fee).

I don't understand this way of thinking, do you also run RHEL 4 on your servers?

That’ll be insane but half-yearly releases of a language spec/language hybrid is insane too, which is what Oracle is doing recently.

Re: Which version of JDK should I use?

#47
post #39
post #30

Earlier quoted context omitted.

It should also work with the latest versions of Gradle (7.2 or so), as the Groovy runtime used by Gradle has since been upgraded. https://github.com/gradle/gradle/issues/16857

Yes, it does now ; but the Groovy runtime still has the general problem of not working with each new JVM version for months after it comes out. Whereas, with the Kotlin runtime, you can just forget about this problem and upgrade as soon as you like.

even if the gradle script is written in kotlin, wouldn't you face the issue with gradle regardless?

Re: Which version of JDK should I use?

#49
post #47
post #39

Earlier quoted context omitted.

Yes, it does now ; but the Groovy runtime still has the general problem of not working with each new JVM version for months after it comes out. Whereas, with the Kotlin runtime, you can just forget about this problem and upgrade as soon as you like.

even if the gradle script is written in kotlin, wouldn't you face the issue with gradle regardless?

No, because Gradle isn't checking the JVM version, the Groovy runtime is. (Specifically, the Groovy compiler seems to run fine on the buildscript, producing a buildscript bytecode file; but then, upon load, the Groovy runtime seems to check that buildscript bytecode file's JVM bytecode version metadata before doing whatever-it-does when loading it.)

Gradle itself isn't written in Groovy; it's 5% Java, 95% Kotlin. The Groovy runtime is only spun up to compile and run Groovy buildscripts (i.e. the default kind of Gradle buildscript with a ".gradle" file extension.) If none of your buildscripts are written in Groovy, then you're not compiling or running any Groovy code, so that runtime check never executes.

Post reply on HN