© Alexandru Jecan  2017

Alexandru Jecan, Java 9 Modularity Revealed, https://doi.org/10.1007/978-1-4842-2713-8_4

4. Defining and Using Modules

Alexandru Jecan

(1)Munich, Germany

In this chapter we’ll start to develop modular applications in Java 9 using some of the features offered by Project Jigsaw. We’ll begin by explaining the new concept of a Jigsaw module together with its module declaration, the module-info.java file. You’ll also learn about the five types of directives that can be used inside the module declaration: requires, exports, uses, provides, and opens. Then we’ll look at compiling and running modules using JDK 9, and for that we’ll introduce the new module path in detail.

The accessibility changes introduced in Java 9 are also covered ...

Get Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.