concept platform module in category java

This is an excerpt from Manning's book The Java Module System.
There are different kinds of modules, and section 3.1.4 categorizes them, but it makes sense to take a quick look at them now. During work on Project Jigsaw, the OpenJDK was split up into about 100 modules, the so-called platform modules. Roughly 30 of them have names beginning with
java.*
; they’re the standardized modules that every JVM must contain (figure 1.11 shows a few of them).Figure 1.11 A selection of platform modules. The arrows show their dependencies, but some aren’t depicted to keep the graph simpler: The aggregator module java.sedirectly depends on each module, and each module directly depends on java.base.
![]()
This is where
jlink
comes in. It’s a Java command-line tool (in your JDK’sbin
folder) that you can use to select a number of platform modules and link them into a runtime image. Such a runtime image acts exactly like a JRE but contains only the modules you picked and the dependencies they need to function (as indicated byrequires
directives). During that linking phase,jlink
can be used to further optimize image size and improve VM performance, particularly startup time.
You end up with a neat list of platform modules that your application depends on. Feed those into
jlink --add-modules
, and you’ll get the smallest possible runtime image that supports your app (see figure 14.2).Figure 14.2 Given the application JARs (top) and their dependencies on platform modules (bottom),
jlink
can create a runtime image with just the required platform modules.![]()