Java Magazine, July/August 2017
ORACLE COM JAVAMAGAZINE JULY AUGUST 2017 17 java 9 This article shows the steps you take to run Java 8 code and use some of the new features of Java 9 without migrating to modules I principally examine what you need to do to get the code compiling and running Getting Started First download and install the latest version of JDK 9 At the time of this writing it is still an Early Access release and can be found here in this article Im using build 9 ea 166 Until the impact of Java 9 on your system is understood you probably dont want it to be the default Java version So instead of updating JAVA_ HOME to point to the new installation you might want to create a new environment variable JAVA9_ HOME instead Ill be using this approach throughout this article You should also look at this detailed migration guide to get a feel for what steps might be needed Before Jumping In You can determine the amount of efort that might be required to migrate to Java 9 without even downloading or using it There are several tools available in Java 8 that will give you appropriate hints Compiler warnings First of course you can look at any compiler warnings because some of those will tell you about potential problems see Figure 1 Im using my IDE IntelliJ IDEA to compile the code and to show me the warnings but what you see in the messages box in Figure 1 is the same as what youd see using javac from the command line Other IDEs such as NetBeans and Eclipse will have similar functionality In Figure 1 you can see that the code has a field with a single underscore as a name This single underscore name has been removed as a legal identi TRISHA GEE PHOTOGRAPH BY JOHN BLYTHE Migrating from Java 8 to Java 9 Step by step work can lead to the adoption of all or some of the features even without using modules Figure 1 Example compiler warning about a potential problem
You must have JavaScript enabled to view digital editions.