Live data from Hacker News

Which version of JDK should I use?

whichjdk.com

161–170 of 258 posts

Re: Which version of JDK should I use?

#161
post #108

Earlier quoted context omitted.

Honestly if you are using Linux you should be using the distros Java.

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.

Re: Which version of JDK should I use?

#162
post #129

Earlier quoted context omitted.

> (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…

> 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. All of this is currently being implemented in project Valhalla...

Valhalla isn't anywhere near complete and has been in development for 8+ years, C# had these features before valhalla was even planned.

Re: Which version of JDK should I use?

#163
I was literally just looking at JDK comparisons out of interest (I already have my app running under a JDK). But I'm still not convinced which is the "best" one.

What are some difference between OpenJDK, Adoptium, Azul, BellSoft, etc. besides company dependencies and lifecycle? Which JDK is the fastest, or do certain JDKs perform faster under certain scenarios? Do any of these JDKs have any special features, or can they not do certain advanced reflection (e.g. for efficiency?)

I use IntelliJ so switching JDK is very easy, and most apps work on any JDK. Plus I doubt anything I release would be relevant in the long term (at least without the ability to upgrade JDK). So I really don't have to depend on any JDK, and seems like I don't have to worry about my JDK getting obsolete. Is there still a reason why I would prefer to use one JDK over another?

Re: Which version of JDK should I use?

#164
post #132

Earlier quoted context omitted.

> (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…

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 development oversight/code review failure (https://nakedsecurity.sophos.com/2014/02/24/anatomy-of-a-got...), to the point where most companies ban writing them.

Just off the top of my head:

* LINQ. Added to C# in 2007, Java didn't get streams until 2014.

* structs/value types, implemented in net framework and net core for 15+ years, but not present in java 17. Some oracle engineers have been working to implement them under project valhalla but it seems to be vaporware at this point after 8+ years of work.

* unsigned types, no plans to implement in java (though IIRC it was originally planned as part of valhalla)

* async/await

At the feature level Java is stuck in the mid 2000s. Nobody wants to do the actual work on keeping it competitive.

Re: Which version of JDK should I use?

#165
post #136

Earlier quoted context omitted.

> take advantage of the jvm In what way? It's slower and has less features than the .NET runtime. > "no real reason" is a stupid take. I could list multiple, but a big one is that there are hundred java developers for each dotnet developer in my city. The java env is well tested and well understood, if anything one should argue why not use it instead of a hip and trendy alternative. So, your only credible excuse for…

> So, your only credible excuse for using java is inertia from boomers and middle managers refusing to adapt from the standard of the early and mid 2000s? If you come in and freely migrate all of the Java codebases to .NET while maintaining code quality and functionalities, I'm sure many people would let you do it. If you don't understand why people stick to one language, that means that you've never worked on a big…

I guess you missed the 'new development' part of my original comment? Obviously it would be nonsensical to port a large extant codebase to a new language and tech stack if it's just being maintained.

Re: Which version of JDK should I use?

#167
post #108

Earlier quoted context omitted.

Honestly if you are using Linux you should be using the distros Java.

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

I use debian on servers and their Jdk has given me 0 issues

I develop on arch and they have a great jdk system as well.

Re: Which version of JDK should I use?

#168

Earlier quoted context omitted.

Oh, I have a fun one. The company I work at leverages Nashorn for running some user-customizable scripts and when upgrading from 8 to 11 we found out that Nashorn changed the way they express numbers under the hood. Basically, every number is either an integer or a float and it used to be that every number was a long or a float. This silently broke a bunch of scripts and callbacks because of class cast exceptions and…

> involving some pretty scary reflection stuff for some unexplained reason This is where it always seems to end up. Why do people bend over so far backwards doing reflection that isn't specified?

Reflection and class loader shenanigans to shoot them selves in the foot.

Re: Which version of JDK should I use?

#169
post #129

Earlier quoted context omitted.

> 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. All of this is currently being implemented in project Valhalla...

I never buy into the tech stack argument that things are being worked on (e.g you mention Project Vahalla but I see this across many languages and tools). Seen this argument used on a number of different technologies. It compares a future state to a current state to put the favored tech (the future state) in an equal or better position. It usually punishes innovative platforms as well; because it dismisses any reason…

You’re missing the point. He claimed Oracle refuses to develop these features or will sue you if you do it yourself (they hired the guy who implemented fibers to implement them in the jvm), but they are actively working on it. The point of my comment was that OP’s claim was just patently false. I wasn’t claiming the JVM has feature parity or is better or anything of the sort.

Re: Which version of JDK should I use?

#170
post #81
post #66

Earlier quoted context omitted.

Err... Not defending Java, but does .NET support Linux at all?

Yes - .NET 5 and 6 both have runtimes and SDKs available for Mac and Linux. At least in my opinion, Linux is the preferred deployment platform for it now unless you have a specific (usually older) library that only works on Windows.

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