- Java 9 Dependency Injection
- Krunal Patel Nilang Patel
- 238字
- 2021-08-27 18:49:57
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:
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:
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.