O'Reilly logo

Modular Programming in Java 9 by Koushik Kothagal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the module

Let's start by creating the new module packt.addressbook.ui. As before, create the module root folder with the same name in the project folder, and then create the module descriptor module-info.java. We already know that we need to depend on packt.contacts and packt.sortutil, so let's add those two dependencies first:

    module packt.addressbook.ui { 
      requires packt.sortutil; 
      requires packt.contact; 
    } 

We need to use the JavaFX libraries in this module, so we need to use the requires clause in the module descriptor to specify this dependency. How do we know what the libraries are? The answer is the same as earlier--using java --list-modules and java -d <module-name>. But before we browse for what modules to depend on, we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required