Live data from Hacker News

Which version of JDK should I use?

whichjdk.com

191–200 of 258 posts

Re: Which version of JDK should I use?

#191
post #161
post #108

Earlier quoted context omitted.

Why? Distros javas are usually way too old to use.

Almost all distros ship at least openjdk-11, and many including Debian have openjdk-17 now.

Cool, but did they had 16? Or will they have 18? I use the newest Java version available.

Re: Which version of JDK should I use?

#192
post #100

Earlier quoted context omitted.

Are JREs still a thing (they were removed from Oracle builds in JDK 9)? Those were mostly for applets or JWS. Nowadays no one keeps just one JRE in their laptop/desktop and disk sizes are in TBs so no point in saving 100 MB and lacking development tools. And in one targets containers or systems with small amount of disk jlink give more gains than JRE.

If you are distributing software based on java a 40mb jre in place of a 400mb jdk is surely preferred. You can build them yourself for each OS you target with jlink, or you can just grab the latest built and tested one from e.g. Bellsoft - but not Adoptium or Oracle. Java has been "breaking changes" between releases to make python blush for a few years now, 17 finally looks like a worthy migration from 8.

JRE is like 44MB, JDK is 190MB. Difference is not 400 MB. And you get jshell, javac all the nice tools that I missed when some wise guys in distro or corp decided JRE is enough.

Re: Which version of JDK should I use?

#193
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…

The JDK itself may receive a similar amount of testing upstream, but libraries downstream tend to receive more testing on LTS JDKs.

Maybe, but those I use didn have any trouble with any java release.

Using so called LTS without paying for it is in no way different from using latest. You get similarly tested software and no one to call if you need a security fix asap.

Re: Which version of JDK should I use?

#194
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…

》All other versions aren't in any way less tested Source?

Even preview features are production ready (I used them in production) . Just the api might change or it could be removed, but quality wise it is as good as it can be.

Re: Which version of JDK should I use?

#195

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…

Yeah, this recommendation is very random

Re: Which version of JDK should I use?

#197

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.

Currently upgrading a ~1M SLoC Java enterprise app (with regular Spring, Jetty in there, scheduled processes, PrimeFaces for web UI, REST API services, SOAP services, the whole shebang) from Java 8 to Java 11 (since 17 wasn't out when that change was approved) and it's largely proving to be a pain. Since the version of Spring is ancient and changes over to Spring Boot were also approved, now have to rewrite parts of…

Upgrading Spring and especially major Boot versions is usually much more work than bumping Java version. Boot change how it does config and such which .. can be confusing.

Re: Which version of JDK should I use?

#198

Earlier quoted context omitted.

There's no real reason to use java for new development in 2021.

Java is way better than .net, which nobody at all uses outside MS. Certainly not in enterprise.

There's tons of .net usage in enterprise, what are you talking about?

Re: Which version of JDK should I use?

#199

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.

Currently upgrading a ~1M SLoC Java enterprise app (with regular Spring, Jetty in there, scheduled processes, PrimeFaces for web UI, REST API services, SOAP services, the whole shebang) from Java 8 to Java 11 (since 17 wasn't out when that change was approved) and it's largely proving to be a pain. Since the version of Spring is ancient and changes over to Spring Boot were also approved, now have to rewrite parts of…

Isn't your problem above essentially with Spring rather than the new JDK? Presumably Spring is using internal APIs that have changed in JDK11. And yes, the reflection and dynamic behaviour in Spring are not type safe (i.e. runtime failures). Spring XML is a manifestation of "Greenspun's tenth rule" - it gives people the flexibility of Lisp/Python by unsurprisingly removing static type safety - not a trade-off that many will agree with. You should tell management that your job had been made harder by the choices made by the original architects of the system (who I assume are long gone),

Re: Which version of JDK should I use?

#200

Is there a way to apt-get the new JDK 17 as a package on Ubuntu, instead of piping a shell script from curl or unzipping a tar? Does anybody use package managers on Linux anymore?

I don't like the 'curl -s "https://XXX" | bash' approach much either, but I've given up trying to work around it.

With SDKMan switching between JDKs is painless, despite the install method of SDKMan itself being one of those.

But it's not just Java. To build our frontend webapp I need NodeJS, and there too some specific version depending on the version of the webapp or just because we've updated.

I'd love to be able to just apt install all of this, but the downsides are just too many.

Post reply on HN