Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java compatibility compilation mode

I'm faced with the following conundrum. I'm currently deploying a Java 8 application on both 32bit and 64bit Windows machines.

Since Java 8 is reaching it's EoL I'm starting to face the very difficult issue on what to do next.

Since Oracle will not be providing 32bit versions of their newer Java versions I have to stick to 8 for now, albeit by moving over to OpenJDK's offering which they seem to pledge to support even further than 8's EoL. For this I'll be also migrating over to OpenJ9 as a VM (which provides a 32bit version).

My question is the following though. I am starting to consider moving over to Java 11. I was wondering, would it be possible to use that jdk to compile in compatibility mode and target version 8 at the cost of not using any 11 specific features?

Also could, the compiled code run correctly in such a combination, that is Java 11 code compiled compatibly and deployed to an environment running on 32bit?

I was also wondering what are the compatibility support for Java 11.

like image 395
akortex Avatar asked Sep 06 '18 17:09

akortex


People also ask

Can Java 11 compiled code run on Java 8?

The class files created by Java 8 are still executable in Java 11; however, there have been other changes in the Java runtime (library changes, etc.) that might require modification of the code. These modifications may be made in Java 8 and compiled with Java 8 making it compatible with the Java 11 runtime.

Is Jdk 17 backwards compatible with JDK 11?

JDK 8, 11, and 17 are all reasonable choices both for compiling and running Scala code. Since the JVM is normally backwards compatible, it is usually safe to use a newer JVM for running your code than the one it was compiled on, especially if you are not using JVM features designated “experimental” or “unsafe”.

Is Java 11 backwards compatible?

Java 11 is backwards compatible with Java 8. So you can swiftly change from Java 8 to 11. If you use some of the packages below, all you need to do is add the replacement dependency to your project. Also, Applets and Java Web Start are completely removed without a replacement.

Is Java 1.8 the same as Java 11?

It is an open-source reference implementation of Java SE platform version 11. Java 11 was released after four years of releasing Java 8. Java 11 comes with new features to provide more functionality. Below are the features which are added in the four and a half years in between these two versions.


1 Answers

I was wondering, would it be possible to use that jdk to compile in compatibility mode and target version 8 at the cost of not using any 11 specific features?

Ideally --release 8 javac flag shall work fine when compiling with JDK11 for Java 8.

I was wondering, would it be possible to use that jdk to compile in compatibility mode and target version 8 at the cost of not using any 11 specific features?

I would guess the bytecode generated after the compilation from the first step could be used consistently across 32-bit and 64-bit runtime systems(environments).

like image 67
Naman Avatar answered Sep 24 '22 04:09

Naman