![]() Let's see how it can affect our compilation output: path/to/jdk9/bin/javac Compile8Test.java -source 8 -target 8 You (or your underlying build system) may've kept using the -source and -target parameters although the -release was just introduced. If you're like us, you may've just upgraded your Java version without putting much thought into how it may affect your compilation process. The -release option was introduced in JDK 9. ![]() This was the correct example, showcasing how you should cross-compile Java for older versions. The output is nothing out of the ordinary: Success ![]() path/to/jdk9/bin/javac Compile8Test.java -release 8Īs a test, we should run it on Java 8: path/to/java8/bin/java Compile8Test Let's compile it for Java 8, using the -release option. It's quite simple and should properly work on Java 8, 9, or later. In the following, we'll compile a simple class to Java 8, using javac from JDK 9. ![]() If you've been cross-compiling Java code for older releases, and were using the -source and -target javac parameters, you may experience unexpected errors when your app is deployed. Beware of the -source and -target javac parameters ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |