![Java 9 Dependency Injection](https://wfqqreader-1252317822.image.myqcloud.com/cover/971/36699971/b_36699971.jpg)
上QQ阅读APP看书,第一时间看更新
Modular JDK
JDK 9 folder structure has changed compared to Java 8; JDK 9 does not have JRE, it is separately installed into a distinct folder. In JDK 9, we can see a new folder called jmod, which contains all the Java platform modules. Java 9 on wards rt.jar and tool.jar is not available in JDK:
![](https://epubservercos.yuewen.com/6E58C4/19470394608891806/epubprivate/OEBPS/Images/13342bd6-d020-405f-8a8e-76b94dd81494.png?sign=1739358764-i1PWHc5lfugeJX3YsmiZAosiaSoaRCkm-0-ed397fd6d3b58af5de610dcc4dfc36d4)
All Java modules, src are available from the ..\jdk-9.0.1\lib\src folder, and each module includes module-info.java. The following is a diagram that shows how JDK looks with all modules:
![](https://epubservercos.yuewen.com/6E58C4/19470394608891806/epubprivate/OEBPS/Images/79677b36-fcee-4b9e-8acf-d18b8b0924b5.png?sign=1739358764-FaHwfAtpMdLRYgP491FXvajJIamwHku0-0-0144da6b20081a4f412a8a1249ad7a1c)
Every other module implicitly or explicitly depends on the java.base module. It follows a directed acyclic graph dependency, which means no circular dependency is allowed between modules.
All modules in JDK 9 are by default dependent on the base module, known as the java.base module. It includes the java.lang package.
We can list all modules of Java 9 using the command -- list-modules. Each module name is followed by a version number with string -@9, to indicate that the module belongs to Java 9. A JDK 9 specific module is prefix with keyword jdk such as jdk.compiler and JAVA SE specific modules start with the java keyword.