Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing Java version compatibility

I have read that "JDKs are usually forward-compatible, and JREs are usually backward-compatible."

What kind of version checking do Java developers do in their applications?

Do you upgrade your JDK with every release?

How do you minimize incompatibilities between releases?

like image 726
sourcenouveau Avatar asked Mar 04 '11 01:03

sourcenouveau


People also ask

Can I install Java 8 and Java 11 together?

I know you can install both. Java 8 and Java 11 and keep them at the same time...


2 Answers

How do you minimize incompatibilities between releases?

  • Reading documents like Incompatibilities in J2SE 5.0 since 1.4.2
  • Using this table to find out all incompatibilities between jdk versions:

enter image description here

The report is generated by the japi-compliance-checker tool.

like image 128
linuxbuild Avatar answered Sep 24 '22 16:09

linuxbuild


The strategy that's worked well for us is to decide up front which versions of the JRE we'll support. We do this by considering the platforms in use by our users, the version-specific features of a particular JRE that we'd like to use, and the release dates of the JRE versions. All of this is done in close consultation with our customer support department. (Of course all else being equal we prefer newer releases, as they tend to have bug fixes, optimizations, security updates, etc.)

Then, this becomes input into our QA process. Our testing effort must encompass all of the versions of the JRE that we're supporting.

Finally, we use the ability to specify specific JRE versions in the JNLP file when we deploy our application, to ensure that customers who try to run our app with an unsupported version get a "fail-fast" experience (with a helpful message about how to get the right JRE version), rather than mysterious failures down the road.

One thing we do to minimize incompatibilities is to avoid undocumented APIs (sun.misc, etc.).

Explicitly checking the current version of the JRE from within your code should be considered only as last resort to work around a known bug in a particular JRE version. If such a bug is discovered early enough in the process, we much prefer to just remove that JRE version from the list of supported versions.

like image 41
Matt McHenry Avatar answered Sep 25 '22 16:09

Matt McHenry