© 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.