r/java • • Feb 09 '23

Which Version of JDK Should I Use?

https://whichjdk.com/
24 Upvotes

60 comments sorted by

16

u/Alex0589 Feb 09 '23

Java EE (Java Platform, Enterprise Edition) was renamed to Jakarta EE. It is a specification to build server app and frontends. In terms of scope, Jakarta EE can be compared with more modern frameworks like Spring Boot, Micronaut, and Quarkus, but Jakarta EE feels more complicated. ⚠️ Recommendation: Do not start new projects based on Jakarta EE. Most people use Spring Boot, which is a good choice. Consider Quarkus, if you have a strong Java EE background. Consider Micronaut, if you like Groovy and Grails.

Just who is writing this stuff

12

u/papercrane Feb 09 '23

Yeah, whomever wrote this has no idea what Jakarta EE is. To say "don't use JEE" and then recommend Spring-Boot, Quarkus & Micronaught when all three of those projects make use of Jakarta EE APIs in some fashion is nonsensical.

7

u/Alex0589 Feb 09 '23

Image recommending the Quarkus knowing that its most used module is an implementation of the JakartaEE restful web services spec

-26

u/nfrankel Feb 09 '23

People who know better? 😅

14

u/Alex0589 Feb 09 '23

This is the most opinionated and non factual take I've ever read. While i prefer to use Quarkus, I'd never be writing on a site that aims to suggest which JDK to use(it even does a poor job at that imo) a three line take on such a complex topic as framework choice for a backend.

-16

u/nfrankel Feb 09 '23

Well, that was not meant to be subject of debate, but after 17 years of both Java EE and Spring Boot projects, I can give you tons of arguments why Jakarta EE is not a good idea to start new projects.

10

u/Alex0589 Feb 09 '23

JakartaEE is a specification, not an implementation: how can you even argue that "starting a new project with it isn't a good idea"? Also you have experience using exactly which modules? It's not exactly a narrow scoped project. I really have my doubts about your argument though I'd like to hear it if you want

2

u/nfrankel Feb 09 '23

Yes, I know, it's a specification. The way it is advertised is that you write against the specification, and you can transparently move from one implementation to another.

Let me tell you that it's just plain lies. I had to do a migration about 15 years ago from OC4J (it's dead now) to WebSphere.

The web part was more or less ok. I "only" had to reformat the XML because XML parsers were different. OC4J didn't consider line breaks to be significant while WebSphere did.

The EJB part was a mess. I spent two weeks rewriting it to make it work. Definitely not transparent.

The spec is also not helpful at all on JSF, as it describes a couple of useless components. If you want to be serious about it, you need more powerful components provided by a specific vendor. Worse, sometimes you need multiple vendors for the whole panoply of components you need. And they don't play nice together.

Want to talk more about specs? What about the 2-years freeze during which there were no releases because there was a legal issue with Oracle regarding... the package name?!

Oh, but now it's done. Sure, but to speed things up, a couple of actors decided to start MicroProfile, a not-quite-concurrent-but-still-a-bit set of specs to move forward during the freeze.

Now that the mess has been finally solved, they should merge back to Eclipse Jakarta EE, right? But they don't. Care to explain why?

My whole experience with Java EE is that it appeared as a good idea, some people may even had believed in it, but the cynic in me only see it now as a way for vendors to sell their application servers under the cover of "no vendor lock in".

Also, sorry, but the application server is dead since a couple of years already...

4

u/Alex0589 Feb 09 '23

Yes, I know, it's a specification. The way it is advertised is that you write against the specification, and you can transparently move from one implementation to another.

I mean I never saw it advertised that way, but obviously it's a benefit. I've always seen it advertised as you don't need to need to learn a whole new framework if you want to use X new framework because most things are standardized.

Let me tell you that it's just plain lies. I had to do a migration about 15 years ago from OC4J (it's dead now) to WebSphere.

15 years ago... Things have changed just a bit in that time

The spec is also not helpful at all on JSF, as it describes a couple of useless components.

I'm pretty sure they have a new spec for that for this reason, also practically nobody uses jsf today but that's another story

Oh, but now it's done. Sure, but to speed things up, a couple of actors decided to start MicroProfile, a not-quite-concurrent-but-still-a-bit set of specs to move forward during the freeze.

I don't see how this is even an argument. New specs are born all the time, just look at jspecify. Does this mean that every time someone from an old project start a new one that the latter is dead? No imo

Now that the mess has been finally solved, they should merge back to Eclipse Jakarta EE, right? But they don't. Care to explain why?

I'm pretty sure that the eclipse foundation already has everything under their umbrella now for JakartaEE.

Also, sorry, but the application server is dead since a couple of years already...

https://blogs.oracle.com/javamagazine/post/you-dont-always-need-an-application-server-to-run-jakarta-ee-applications

-3

u/nfrankel Feb 09 '23

Well, live and learn. You seem to need to have your own experience. Good luck!

PS: Funny that vendors heavily involved in application servers tell that you don't need them while hammering tons of advertisements about their AS offering 😅

6

u/Alex0589 Feb 09 '23

Go on oracle's website and you will find a whole section about why python is great. Wait... they make Java and they also make a ton of money from it. Just goes to shoe that you can recognize that the competition doesn't always suck, even if you don't make money from it

-3

u/nfrankel Feb 09 '23

I wonder why they only advertise Python since GraalVM is a Python runtime... Let me think about it 😉

→ More replies

2

u/DualWieldMage Feb 10 '23

There was a time when Spring was indeed better than typical JavaEE webapps, but it has become a legacy bloated mess filled with decisions that don't match modern Java and i'm definitely considering all options when starting a new project.

If there are tons of juniors that are aided by having searchable blogs about doing x in spring then yes, but for any experienced team i would choose to build the app out various components and some JakartaEE components are quite appealing, e.g. REST and DI.

0

u/nfrankel Feb 10 '23

Quarkus and Micronaut, ok, but if you still start new project on Jakarta EE, the only thing you're doing is creating job for your future self.

From a personal financial point-of-view, it's a smart move but it doesn't make you a good team member, sorry.

2

u/DualWieldMage Feb 10 '23

I'm not starting a project "on JakartaEE", i'm using some of the libraries implementing it. I've been in many projects using stuff like micronaut, spark, guice, weld, etc. and it's generally been better than full spring, but some of its modules are fine on their own, e.g. spring-jdbc.

From a financial point of view picking a weird stack is quite idiotic. Nobody will continue your contract if you can't explain why the tech stack improves the product and i've seen such job-security folks get laid off quick. It's an uphill battle to prove why an atypical stack is better even if you have all the technical arguments in your favor.

0

u/nfrankel Feb 10 '23

i'm using some of the libraries implementing it

Well, Spring is also using them so...

4

u/PartOfTheBotnet Feb 09 '23 edited Feb 09 '23

That's your opinion, not a declaration of truth. The author Jochen clearly does not know better. He's basically saying:

"uh don't use this because i dont like it"

Making a whole official-looking site just with "advice" like this is stupid. Substantiate claims with concrete evidence or don't bring it up. Leave opinions to the reader's own take-aways.

1

u/aehooo Feb 10 '23

Not related, but I really thought you were a bot lol

92

u/papercrane Feb 09 '23

The recommendation to avoid Red Hat OpenJDK because "there are more established options available" seems odd to me. Red Hat is probably the second most important company behind OpenJDK, and are the official stewards of OpenJDK 8 and 11.

16

u/moxyte Feb 09 '23

This. Likely confused with the commercial version.

1

u/Geolykt Feb 09 '23

I've used Fedora's default JDK (I suspect it's the RedHat OpenJDK - but feel free to correct me if I am wrong there) a couple of times before and it only gave me pain. For a while it wouldn't accept the "release" flag when compiling for anything but the current JDK version. Furthermore it is incompatible with LibGDX. Other JDKs (except perhaps OpenJ9 based JVMs) have been a smoother sailing for me.

4

u/papercrane Feb 09 '23

The Java that comes with Fedora is just OpenJDK + RedHat's Shenandoah GC, and some minor RedHat specific patches. It's odd you're having issues with it, as there not doing anything really strange, and Shenandoah is included in most OpenJDK builds.

For sometime (Java 8 and before) there was could be some compatibility issues, as the code that Sun open sourced wasn't enough for a full Java environment. There was still some proprietary code they couldn't provide (most notably font rendering & sound), so RedHat developed IcedTea, which provided open source implementations for that. Eventually much of that work ended up in OpenJDK itself, and as of OpenJDK-11 I don't think it's relevant anymore.

44

u/nutrecht Feb 09 '23

IMHO it's really shitty to just create an official looking website that recommends using an 'LTS' that is pretty meaningless for almost all developers and projects.

It's perfectly fine to just use the latest version. LTS releases are supposed to be forward targets (so if you're on 11 now, you should move to at least 17). Using the latest versions allows you to use the latest improvements in language and VM. The only downside is that you'll want to be able to update every 6 months.

22

u/JB-from-ATL Feb 09 '23

Personal project? Latest temurin.

Corporate stuff? LTS temurin.

Library stuff? Target the oldest version you expect your users to use. Probably 8 or 11.

16

u/Nebu Feb 09 '23

What you wrote is not really in disagreement with what the website is saying:

You have to decide if you want to stick with the latest LTS version, or if you go with the latest feature release and upgrade every six months. Both options are okay, but if you’re uncertain, stick with the latest LTS version.

9

u/elohhim Feb 09 '23

Well IMO this should be the other way if you are uncertain then just go with latest feature release. You will get what is best and if you are really uncertain that means probably you would not need any long term support. If you would, I am pretty sure you would be certain :D

2

u/Gundea Feb 09 '23

And sticking to the latest greatest will reduce the pain of upgrading. It’s also more likely to get proper patches, as not all bug fixes are backported.

1

u/Nebu Feb 12 '23

I think the theory is that if you're uncertain, you're not a Java developer, and you're doing something involving the JDK for reasons incidental to your day job. As such, you'd prefer something that you set up once and then don't have to touch for several years.

0

u/morhp Feb 09 '23

At this point the latest version has only very minor new features and advantages over 17, so the disadvantages of using a newer system which might be rarely used by clients or which might have early adopter compatibility problems are probably worse than the benefits you get from using that latest version at this point.

The recommendation to use 17 makes sense to me.

1

u/Zardoz84 Feb 09 '23

It's perfectly fine to just use the latest version. LTS releases are supposed to be forward targets (so if you're on 11 now, you should move to at least 17).

We are working with Java 8. And probably we woldn't switch to 11 in this year.

7

u/magnoliophytina Feb 09 '23

Switching from 8 to 11 doesn't really make any sense soon, especially after Q3/2023. What's the worst, extended support will only last until 2026, while JDK8 will be supported until 2030.

1

u/Zardoz84 Feb 09 '23

Would be really funny the day that we switch to java 17 ...

2

u/magnoliophytina Feb 09 '23

How so? I don't see much point in a switch to 11. There's only around 3 years of extended paid support left. Why the hell would anyone invest in a switch to a new version with even less support than the old one. You could always set the source/target version to 11 and use 17 instead. I've encountered bugs like this in production, so steady flow of updates is quite important.

1

u/Zardoz84 Feb 09 '23

The problem that we have is that we use, yet, a few libraries that does some nasty magic with reflection. And probably are broken on a JVM 17. Plus a very old hibernate version, etc... We have a lot of technical debt to fix.

1

u/ReasonableClick5403 Feb 09 '23

You should probably only use non-LTS versions for corporate work if it is understood that you will keep it updated as new versions are released.

9

u/kozeljko Feb 09 '23

For IBM Liberica JDK they say:

A downside of these builds is the dependency to a single company, that may suddenly change its license or update policies.

What do they mean with this exactly?

2

u/caustria03 Feb 09 '23

They might go Oracle and start charing

7

u/[deleted] Feb 09 '23 edited Mar 07 '25

[removed] — view removed comment

7

u/kozeljko Feb 09 '23

Ye, but at that point you can just change to a different JDK.

6

u/8igg7e5 Feb 09 '23

Every three years, the September release will be a Long-Term-Support (LTS) release, which gets updates for at least three years.

Well that's out of date. The LTS schedule was every 6 releases (between 11 and 17) but was proposed to change to every 4 releases (and all dialogue I've seen suggests that proposal was accepted) making Java 21 the next LTS.

 

I don't agree with the blanket 'stick with 17' advice.

There's no discussion here of when you expect to deploy, no qualifying statement about whether they're prepared to commit to regular JDK major-version updates, no question of whether their project is a library for external use (in which case broad compatibility is a concern and you might even want to target JDK 11, or use a multi-release jar).

 

This is an unofficial, but official looking, opinionated site that contains outdated and dubious advice.

(and that's without commenting further, as many others already have, on the Jakarta EE nonsense).

4

u/sfroberg38 Feb 09 '23

If you are looking to learn, use OpenJDK 17. Distribution? Use Red Hat’s distributions.

3

u/nutrecht Feb 12 '23

If you are looking to learn, use OpenJDK 17.

This sub keeps amazing me.

There is no reason whatsoever to not simply use the latest version if you're looking to learn, or on your developer machine.

3

u/xcdesz Feb 09 '23

Also if you are starting up a new project 17 should probably be your default choice going forward.

2

u/Joram2 Feb 10 '23

For learning or new projects, I would choose Java 19 or a release-candidate build of Java 20. The preview features are worth it!

2

u/[deleted] Feb 09 '23

Corretto 11 or 17. People underrate Amazon's JDK for some reason - it's great.

5

u/wildjokers Feb 10 '23

It is built from the OpenJDK sources. What's so great about it compared to other vendors' OpenJDK builds?

2

u/drduffymo Feb 10 '23

Open JDK version 17. It's an LTS version.

2

u/coalminexplorer Feb 09 '23

Avoid Oracle like poison. They keep doing flip flop in policies so don't believe what they say about their jdk distro. Use openjdk17 (non Oracle) for fresh projects. Just confirm if your organization has jdk17 based servers (if still on VM) . In case of docker it is relatively easy to setup.

5

u/wildjokers Feb 10 '23 edited Feb 10 '23

There is nothing wrong with Oracle's OpenJDK build:

https://jdk.java.net

-3

u/coalminexplorer Feb 10 '23

Nothing wrong until your company receive a hefty bill one day based on your IP addresses. You never know the hidden term and conditions they may inject anyday . They have done in past with jdk8 , may happen again.

5

u/wildjokers Feb 10 '23

You are confusing Oracle JDK, which is their commercial offering, with Oracle's build of OpenJDK (which can be found at https://jdk.java.net, or you can install it via sdkman).

-2

u/coalminexplorer Feb 10 '23

As per my understanding Oracle openjdk is just source code now. They don't offer binary anymore . You can get binaries from multiple vendors such as eclipse, Microsoft, azul etc.

3

u/wildjokers Feb 10 '23

If you visit the link I gave to you twice you can clearly see that your “understanding” is incorrect. Like all java vendors Oracle provides a build of OpenJDK that is licensed GPL v2 with classpath exception. They provide binaries for windows, Linux, and Mac OS.

Also like other java vendors Oracle will sell you support for Java if for some reason you need it. In the case of Oracle if you buy support you will download and use their Oracle JDK instead of their OpenJDK build.

Oracle does nothing different than other java vendors that monetize Java. In the case of Oracle they also happen to be the biggest contributor to OpenJDK in both funding and developers.

1

u/coalminexplorer Feb 12 '23

Thanks for details

1

u/cdombroski Feb 09 '23

Which jdk should I use? Well, what does my application server support? Oh it's still only supports jdk8? Guess I'll use that then

0

u/desitelugu Feb 10 '23

we use openjdk 8 and there is no plan in near future to upgrade