Before Java 9 the Java development kit was a monolithic set of packages, packaged in one jar file the rt.jar which any Java application would need to deploy along with its own code.
- The Java platform had Grown overtime to include about 25 different frameworks.
- Even if your application only ever used one class in a package, you would need the rt.jar which included all of these frameworks.
- Project jigsaw was the name of the project created to modularize the JDK
Goals of modularizing the Java Development Kit
The goals of modularizing the Java development kit were summarized by the Project Jigsaw Team and restated here:
- more scalability by allowing the Java development kit to more easily scale down to smaller platforms
- Improve security by protecting the internals of the Java development kit
- Improved maintainability by publishing dependencies and reducing the amount of interdependencies
- Improved application performance by allowing configuration flexibility
- Easier construction of and maintenance of libraries in large applications
The Java designers spent a lot of time deconstructing the monolith, decoupling the frameworks and reconstructing the code into smaller sets of code (a few dozen modules) that met the 5 objectives outlined above.
The smaller sets of code, nicely packaged into modular jar files, comprise the modular JDK.
The Modular Java Development kit is split into two sections.
The Java SE, the Java Platform standard edition (Java SE) APIs
These API's define the core Java platform for general purpose computing.
These API's are in modules whose names start with a Java prefix.
In the diagram above the Java.se module has dependencies on all of the modules shown, whereas java.base has no dependencies but is the required dependency for all the modules shown The arrows are called read edges, read because the module is said to be able to âreadâ another if properly configured as dependent on it. For example, the java.xml module is said to read the java.base module .
Note that a module graph only displays module dependencies, and will not include packages.
The JDK implementation of this module provides an implementation of the jrt file system provider to enumerate and read the class and resource files in a run-time image. The jrt file system can be created by calling FileSystems.newFileSystem(URI.create("jrt:/")).
The Java dot based module is described as the foundational APIs of the Java SE platform, which include the core packages such as 1) java.lang, 2) java.util, 3) java.io