Chapter 14. The Java Module System

 

This chapter covers

  • The evolutionary forces causing Java to adopt a module system
  • The main structure: module declarations and requires and exports directives
  • Automatic modules for legacy Java Archives (JARs)
  • Modularization and the JDK library
  • Modules and Maven builds
  • A brief summary of module directives beyond simple requires and exports

The main and most-discussed new feature introduced with Java 9 is its module system. This feature was developed within project Jigsaw, and its development took almost a decade. This timeline is a good measure of both the importance of this addition and the difficulties that the Java development team met while implementing it. This chapter provides background on why you should care as a developer what a module system is, as well as an overview of what the new Java Module System is intended for and how you can benefit from it.

Note that the Java Module System is a complex topic that merits a whole book. We recommend The Java Module System by Nicolai Parlog (Manning Publications, https://www.manning.com/books/the-java-module-system) for a comprehensive resource. In this chapter, we deliberately keep to the broad-brush picture so that you understand the main motivation and get a rapid overview of how to work with Java modules.

14.1. The driving force: reasoning about software

14.2. Why the Java Module System was designed

14.3. Java modules: the big picture

14.4. Developing an application with the Java Module System

14.5. Working with several modules

14.6. Compiling and packaging

14.7. Automatic modules

14.8. Module declaration and clauses

14.9. A bigger example and where to learn more

Summary

sitemap