Using the Java 9 compiler and runtime
Let's get started with the first step--compiling and running an old code base using the Java 9 compiler and runtime. It'll be great if things work as-is. If changes are required, we'd like to make as few of them as possible.
First, make sure you are using Java 9 using the following command. If you have a different version, you'll need to switch, as covered in Chapter 2, Creating Your First Java Module:
$ java --version
From the project folder, create a new out directory for our compiled classes and run the following Java compiler command to compile all the .java
files:
$ mkdir out$ javac -cp lib/commons-collections4-4.1.jar -d out $(find . -name '*.java')
In the preceding javac
command, we are adding the commons collections JAR file to the classpath using the -cp
option, specifying the output directory for the compiled classes using the -d
option and then specifying all the .java
files in the following directories recursively using $(find . -name '*.java...