Live data from Hacker News

Which version of JDK should I use?

whichjdk.com

251–258 of 258 posts

Re: Which version of JDK should I use?

#251
post #218

Earlier quoted context omitted.

> unsigned types, no plans to implement in java (though IIRC it was originally planned as part of valhalla) Not too comfortable to use functions that will compile to efficient byte code exists for them, but with the definitely coming Valhalla, it will be trivial to create a custom primitive class for unsigned ints. > async/await With project Loom, it will avoid the mistake of function coloring that async introduces.…

> With project Loom, it will avoid the mistake of function coloring that async introduces. In a managed language, why not let the runtime automatically transform blocking calls to non-blocking, when it already knows what’s up? Not saying it's a good or bad thing, but .NET and C# by extension has had these features for years (decades in some cases) while the only thing java has are half-baked prototypes and plans to '…

It’s not like async/await is a must, they are on the surface just syntactic sugar.

In the background, coroutines are a strictly less useful feature than what will happen with Loom, and please show me any “promised feature” that were only half-baked prototypes? We do have one half of Valhalla (vector api) under an experimental flag with JDK 17 already, several language related JEPs were shipped already. That Loom and primitive classes take their time only mean that they are not vaporware, because these are actually ridiculously complex problems.

Re: Which version of JDK should I use?

#252
post #122
post #59

Here's my recommendation (I work on OpenJDK at Oracle): If you're using the current JDK version (recommended for regularly maintained applications), it doesn't matter which distribution you choose, as they're all pretty much identical. If you're using an old version (LTS, intended for legacy applications, which might benefit from it), pick a vendor you trust for OpenJDK support, as the builds are not the same, and ne…

> Eclipse Adoptium, built by IBM, which is the only distribution built by a team that isn't involved with the OpenJDK project Wasn't AdoptOpenJDK the "legit" recommendation a couple years ago? I only heard about all of these other versions sometime later. (Looking again, it looks like the Oracle OpenJDK is shipped in Ubuntu's repos, so maybe I was mistaken).

I too was under the impression that AdoptOpenJDK was the current default choice (if you’re making a choice). Can anyone else comment on this? I have to use JRE on windows, so no distribution-provided option.

Re: Which version of JDK should I use?

#253

These recommendations are pretty arbitrary and don't even attempt to scratch the surface of what is actually materially different between the JDKs. Don't use Corretto outside of Amazon... why? Don't use Dragonwell because... China bad? Use Red Hat OpenJDK if you're running on Red Hat servers, Microsoft OpenJDK if you're on Azure, SapMachine if you're on SAP, because... the name matches so that's nice? At least they'r…

> Use Red Hat OpenJDK if you're running on Red Hat servers, Microsoft OpenJDK if you're on Azure, SapMachine if you're on SAP, because... the name matches so that's nice? Presumably this has to do with support and possible testing. People buy RedHat EL for the longterm support, if they use a different vendor for the JDK they have to set up a whole new contract for that with a different company. By contrast, people us…

i think it has to do with that image is quicker to load. if you are using the coretto image(aws) on azure, then you are not guaranteed that the local docker repository has it cached, so it will take very long to load. Also support will be more difficult, if you use the non native image.

Re: Which version of JDK should I use?

#254

Earlier quoted context omitted.

.NET 5 finally delivered Linux support but only eleven months ago, so I would test it some before betting the farm.

.NET has been on Linux for years now. And my company is using it in production on Kubernetes (Linux/Debian). Its crazy how dependable and fast it is. Startup times are amazing and its only getting better each year. We're looking to upgrade to .NET 6 in production by January. Have you even seen the benchmarks compared to Java and other languages? https://www.techempower.com/benchmarks/#section=data-r20&hw=... If you'r…

I can also confirm that I’ve been using .NET on non Windows OSes for years and it works really well. However the Benchmarks are rigged. The code they wrote for that one benchmark for in the top is a complete cheat. Check out the source and compare it with the other ones from the top 10. .NET is fast but Java is truthfully still faster.

Re: Which version of JDK should I use?

#255

Earlier quoted context omitted.

I've been using it exclusively on Linux since 2.0. Both running and developing.

> exclusively on Linux since 2.0. .NET Core 2.0 (August 2017) we assume.

That was implied. The original NET 2.0 was never available on Linux. Mono used a different versioning scheme IIRC.

Re: Which version of JDK should I use?

#256
post #132

Earlier quoted context omitted.

Records, switch expressions, multi line strings and that is only language changes. You could call `+` syntatic sugar, just like anything past assembler being that.

> Records, switch expressions, multi line strings and that is only language changes. None of those are features, they were desperately needed shorthands for common java idioms. This is like calling braceless if/for/while statements 'features', when they're purely syntax sugar that has fallen out of favor completely because there's been several major security vulns found in major projects due to their use and developm…

With your explanation everything is just a shorthand. All you really need is NAND.

Streams are a library feature, records are a language feature. Streams could be implemented outside, records could not (no lombok abominations are not records).

comparing braces to records/multi line strings/switch expressions is so funny that I won't even comment on that.

Re: Which version of JDK should I use?

#257
post #122
post #59

Here's my recommendation (I work on OpenJDK at Oracle): If you're using the current JDK version (recommended for regularly maintained applications), it doesn't matter which distribution you choose, as they're all pretty much identical. If you're using an old version (LTS, intended for legacy applications, which might benefit from it), pick a vendor you trust for OpenJDK support, as the builds are not the same, and ne…

> Eclipse Adoptium, built by IBM, which is the only distribution built by a team that isn't involved with the OpenJDK project Wasn't AdoptOpenJDK the "legit" recommendation a couple years ago? I only heard about all of these other versions sometime later. (Looking again, it looks like the Oracle OpenJDK is shipped in Ubuntu's repos, so maybe I was mistaken).

> Wasn't AdoptOpenJDK the "legit" recommendation a couple years ago?

It was the recommended choice by random internet users who posted blogs, just as is this website, a random website by some random person.

The best way for you to understand which JDK to use is to understand superficially what is involved with the source code and the build process between vendors, and their licenses.

Source code starts out the exact same, that's why they are all OpenJDK, because they take the source code from the OpenJDK public repository's main branch.

From that point on, they can choose to apply source code patches from OpenJDK that have not yet been merged into the main branch, or they could apply their own source code patches. Those patches often will be security fixes, or backported features. Here you have to understand that there is only one main branch of Java. So if you want security fixes or new features but are still on say Java 8, someone has to pull the old commit that was tagged Java 8 and selectively cherry pick a bunch of commits afterwards to apply over it that retrofits all security fixes and possibly a few select new features (like say some performance improvements patches). And if you've ever had to do a cherry pick merge on old code, you know it can be tricky and sometimes there are conflicts and maybe you even need to manually resolve them.

And even if they are not grabbing the source from an older tagged version commit, but are grabbing it from the latest tagged commit (so as of this writing Java 17), well it might already be that there are some newer commits that fixed some security bug, or other bug, or improved performance or startup, etc. So in their build of Java 17 they could even decide to apply some of those patches that happened after to the Java 17 latest release. And they might even choose to apply some patches that haven't even made it to the main branch yet, so maybe still have an open PR, or they are the ones patching something of their own.

After having grabbed the main source of OpenJDK, and potentially applied some patches to it, they proceed to build it for one or more platforms.

In the process of building, they will choose which platform to build for, such as Windows, Linux, MacOS, x64, ARM64, x86, etc. And they will choose what to include in the build, for example should you bundle Java Mission Control, javafxpackager, jarsigner, jstatd, visualvm, etc.

Finally they can choose to tests each build on each platform they built it for by running the full test suites, but they could also only partially test, as in, run only a subset of the tests, or tests only a subset of the platforms they built it for.

You'd want to run tests especially if you did patch the source, to make sure none of your patches introduced bugs, but the build could also have created an issue which tests could uncover, like forgotten to include some important C lib, or resource, or built with wrong optimization options, etc.

And last but not least, the license they choose. There's two parts here, the first one is that if they made any changes to the source of their own, their changes might be on their own license, or might not even be open source. That means you might not be able to fork the exact source they used for your own needs, or even get to see the full source they used. The second are the terms of use for each things bundled in the build. Do they let you use the JRE for cloud applications? Can you redistribute it to others? Can you use it for commercial work, etc.

Hopefully that better equips you to understand. Most of the companies who make money by building OpenJDK and offering support will probably do a good job at making sure that they backport security fixes as soon as possible, and make sure to always test everything to be sure their backport and custom patches didn't break anything, but they might not always do so for your chosen platform. But as any company who wants to make money, they need to have some of their customers pay them at some point, and that's where licensing and terms of use come in, but more and more they go full open source on their source patches and customization, allow anyone to use things for free in all settings, but offer paid support, though to be sure read their license and terms of use.

And if you can't be bothered to read their license or terms of use, that's why people have been recommending AdoptOpenJDK which is now Eclipse Adoptium. Since they're a community effort managed by a non-profit, you can be more confident that their license and terms will be and remain fully open source and free to use in all cases. The downside is that it's a community effort, you don't know if they'll apply security patches quickly, or fully test, etc. And if there's any issue with the build you encounter, there's no real support, no SLA for it, etc.

P.S.: There also exists some alternate JDKs, that are not based from the OpenJDK's main source branch, such as OpenJ9, GraalVM, Zing, JamaicaVM, etc. Those should be considered as alternate implementation of Java, they often have very different runtimes and garbage collector and all that, though they can still partially be using some of the stuff from the OpenJDK as well. While all the OpenJDK builds I was talking before always implement everything using the OpenJDK source, all they'd do is add security fixes, bug fixes, retrofit some newer features into older releases, etc. They wouldn't provide alternate implementation of anything the way that GraalVM or OpenJ9, et all, will do.

Re: Which version of JDK should I use?

#258
post #59

Here's my recommendation (I work on OpenJDK at Oracle): If you're using the current JDK version (recommended for regularly maintained applications), it doesn't matter which distribution you choose, as they're all pretty much identical. If you're using an old version (LTS, intended for legacy applications, which might benefit from it), pick a vendor you trust for OpenJDK support, as the builds are not the same, and ne…

> and isn't a member of the OpenJDK Vulnerability team Any reasons they are not a member? I would think IBM is trustworthy and mature enough to deal with sensitive security issues.

It's not managed by IBM anymore, it's managed by a community of volunteer and the Eclipse foundation. IBM gave it away a whole or back to the community.
Post reply on HN