Can newer JRE versions run Java programs compiled with older JDK versions?

As answered already you are mostly safe and most products and 3rd party libraries will simply work. However there do exist very rare cases where binary incompatibilities (ones where the class file compiled using older JDK will fail to run in the newer JVM) were introduced between JDK versions.

Official list of Oracle Java incompatibilities between versions:

Compatibility tool

Packaged with JDK 9, there is a tool called jdeprscan which will verify the compatibility, list no longer used APIs within your code and suggest alternatives(!). You can specify the target JDK version (works for JDK 9, 8, 7 and 6) and it will list incompatibilities specific to your target version.

Additional comment in case of libraries:

A reasonable rule of thumb is to use latest stable release version of library for the JRE version your software targets. Obviously you will find many exceptions from this rule, but in general stability of publicly available libraries usually increases with time.

Naturally API compatibility and versioning have to be considered when changing versions of dependencies.

Again most popular dependencies will have web pages where such information should be available.

If however you are using something a bit more obscure, you can discern which JRE were the classes within your dependency compiled for.

Here is a great answer on how to find out class version. You might need to unzip the JAR file first.

Leave a Comment