Compatibility and migration from Java 9 to Java 8

xdevel2000 :

I'm reading the document about the new Java 9 module system.

The paragraph 3 Compatibility & migration explains how to migrate code from Java 8 to Java 9, but says nothing on how "migrate" or run an application written in Java 9 to pre Java 9 runtimes.

So, if I have, say a JAR application written in a modularity way (every module has a module descriptor) what does happen if I deploy it on, i.e, a JDK 8 runtime?

BetaRide :

You cannot start a Java application with a JRE which is less than the one it is built for.

If you just use javac without any special options it will produces classes which do run on JREs equal or bigger than the one of the used JDK.

However javac supports cross compilation. You can use JDK 8 to compile JDK 6 compatible class files. Search for Cross-Compilation Options in the javac docs.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=466198&siteId=1