Hacker News new | ask | show | jobs
by bombcar 1723 days ago
But Java 8 -> 16 doesn’t work without changes.
2 comments

Completely depends. You can write Java in 2021 that works with both old and new Java, especially if you don’t use any dependencies.
Sure and you can write code that is valid C and valid shell- but there have been major breaking changes to Java (iirc Minecraft barely started working with Java 16 this year).
You have to distinguish Java the language and the JVM: Class files generated by any (?) version of the Java compiler before the JVM version you’re using will usually work on the newer JVM. Java 9+ started removing classes, breaking API compatibility: but, generally, there are additional jars/command-line options that can be used to restore the older behavior.

Minecraft, in particular, has always worked fine with Java 9+, ime: if you know the flags to apply (and delete the jar that checks the Java version), it more or less just worked. I’ve been running it for a year+ on new JVMs so I could use the Shenandoah GC and take advantage of more of the 128GB RAM in my desktop.

Not any longer, as per Java 17, people have had enough time to port their code, and those switches now "do nothing".

This is the last step before they get fully removed.

None of those changes are required for use, and more importantly, nothing has been DROPPED to make old code obsolete.
This isn’t exactly true: javax.xml.bind-related ClassNotFound errors are a fairly common problem when running old Java applications on new JVMs. Thankfully, the solution is just to include the relevant jar that implements the classes that have been removed.
Depends, some libraries work, some need special parameters, some don't work at all