Chapter 12. Java Platform Modules

With the release of Java 9, the platform finally gained the long-awaited modules system. This feature had originally been intended to ship as part of Sun’s Java 7 release, before the acquisition by Oracle. However, the task proved to be far more complex and subtle than anticipated.

When Oracle acquired Java (as part of the technology they received from Sun Microsystems) Mark Reinhold, Java’s Chief Architect, proposed “Plan B”, which reduced the scope of Java 7 to allow for a quicker release.

Java platform modules (“Project Jigsaw”) was pushed back, along with lambdas, to Java 8. However, during the development of Java 8, the size and complexity of the feature led to a decision that, rather than delay Java 8 (and availability of lambdas and other highly desired features), it would be better to defer modules to Java 9.

The end result was that the modules capability was delayed first to Java 8 and then to Java 9. Even then, the scope of the work led to substantial delays in the release of Java 9, and so modules did not actually ship until September 2017.

In this chapter we will provide a basic introduction to the Java Platform Modules System (JPMS). However, this is a large and complex subject—interested readers may well require a more in-depth reference, such as Java 9 Modularity by Sander Mak and Paul Bakker (O’Reilly).

Warning

Modules are a relatively advanced feature that are primarily about packaging and deploying entire applications and their ...

Get Java in a Nutshell, 7th Edition 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.