It would be amazing if our modular JARs could be run with pre-Project Jigsaw JDK applications. This way, we will not be concerned with writing another version of our API for pre-JDK 9 applications. The good news is that we can use our modular JARs just as if they were ordinary JARs, that is, JARs without module-info.class at their root. We will see how to do so in this recipe.
Using a module JAR with pre-Project Jigsaw JDK applications
Getting ready
For this recipe, we will need a modular jar and a non-modular application. Our modular code can be found at Chapter03/4_modular_jar_with_pre_java9/math.util (this is the same math.util module that we created in our Creating a simple modular application recipe). Let's compile...