Technical Overview & Strategic Context
After multiple delays, Oracle released the final version of Java 9 in September 2017. The core update is the modularization of the JDK through Project Jigsaw, which improves security and reduces runtime sizes. Beyond modularity, Java 9 introduced JShell (an interactive REPL console) and made the G1 (Garbage First) collector the default garbage collector, optimizing performance for large-scale enterprise applications.
Architectural Principle: Use the jlink tool to bundle modular Java applications with minimal runtimes. Leverage the G1 garbage collector to improve heap performance.
Core Concepts & Architectural Blueprint
Project Jigsaw structures the JDK into distinct modules, allowing developers to create custom JRE packages that bundle only the modules required by the application. JShell provides an interactive REPL console for testing Java expressions, while making the G1 collector the default garbage collector optimizes GC performance for enterprise systems.
Performance & Capability Comparison
| Java Feature | Java 8 Standard | Java 9 Standard | Operational Benefit |
|---|---|---|---|
| Runtime Structure | Monolithic JDK packages | Modular JDK modules (Project Jigsaw) | Reduces runtime size and footprint |
| Garbage Collector | Parallel GC default setting | G1 (Garbage First) collector default | Reduces GC pause times on large heaps |
| Interactive Console | No native interactive shell | JShell REPL console | Allows rapid testing of Java expressions |
Implementation & Code Pattern
To write a modular Java application and compile it under Java 9 guidelines, follow these steps:
- ◆Create a module-info.java file in the source directory.
- ◆Specify dependencies using requires statements in the module configuration.
- ◆Compile the modular Java application using the javac tool.
- ◆Generate custom, lightweight runtime images using the jlink tool.
// Compiling and running modular Java 9 applications
// Directory structure:
// src/in.shivamitcs.analytics/module-info.java
// src/in.shivamitcs.analytics/in/shivamitcs/analytics/Engine.java
// module-info.java
module in.shivamitcs.analytics {
exports in.shivamitcs.analytics;
}
// Engine.java
package in.shivamitcs.analytics;
public class Engine {
public static void main(String[] args) {
System.out.println("Java 9 Modular Engine: Active");
}
}
// Compilation commands:
// javac -d mods/in.shivamitcs.analytics src/in.shivamitcs.analytics/module-info.java src/in.shivamitcs.analytics/in/shivamitcs/analytics/Engine.java
// java --module-path mods -m in.shivamitcs.analytics/in.shivamitcs.analytics.EngineOperational Governance & Future Outlook
The final release of Java 9 introduced key improvements to modularity and performance. Project Jigsaw modularization and the default G1 garbage collector help ensure enterprise Java systems remain scalable.