Everyone working in Java technology uses JDK(Java Development Kit) software to develop & run the code. You can’t write the code or develop an application in Java without installing the JDK software on your system. However, in this blog we will learn about the internal structure of JDK & compare the structures of Java 8 & Java 9. We have major changes in the structure of Java 9. Our title for this blog will be “Structure of JDK : Java 8 vs Java 9”
Let’s discuss each component of JDK step by step:
This folder is the root directory of our java software containing sub-folders bin, lib, include etc. Needless to say, it is mandatory to have installed in our system before the start of any kind of development.
bin folder contains binary files in the form of executable files(.exe). Moreover, this folder contains javac, java, jar, javap, javah executable files.
— javac.exe : to compile the source code
— java.exe : to run the compiled code (JVM software)
— javap.exe : Bytecode reader software (decompiler)
— javadoc.exe : Document generating software
— jar.exe : Java archive creator software(zip)
lib folder contains library files which are predefined programs containing logics to perform some operation. Moreover, they are used to develop new program by using their predefined logics. Furthermore, it contains tools.jar, dt.jar, ant-javafx.jar etc…
—tools.jar: Contains non-core classes(.class files) for support of the tools and utilities in the JDK software.
–dt.jar: DesignTime archive of BeanInfo files that tell interactive development environments (IDEs) how to display the Java components and how to let the developer customize them for an application
–ant-javafx.jar: Contains Ant tasks for packaging JavaFX applications.
jre stands for ‘java runtime environment’ and as the name suggests it provides runtime or the execution environment to the java program. However, the runtime environment is an implementation of the Java platform. Moreover, this is the directory which represents java.home system property. jre mainly contains bin and lib sub-folders.
jre/bin folder contains executable files and DLLs for tools and libraries used by the Java platform. The executable files are identical to files in jdk/bin. This directory does not need to be in the PATH environment variable.
jre/bin folder contains libraries, property settings, and resource files used by the Java runtime environment. Moreover, it mainly contains rt.jar, charsets.jar, jfxrt.jar etc…
rt.jar : rt.jar contains several .class files for running programs & developing our new programs. However, these are also called Bootstrap classes (the RunTime classes that comprise the Java platform’s core API)
This folder contains files used for security management. Furthermore, these include the security policy (java.policy) and security properties (java.security) files.
src.zip file exists under JDK (parent) directory. Moreover, it contains source code for the Java platform.
Structure of JDK : Java 8 vs Java 9
jdk9/jmods folder (newly introduced in jdk9 : Project Jigsaw)
This is a newly added feature in JDK structure to modularize the JDK. Moreover, the primary goals of this feature is to make it easier for developers to construct and maintain libraries and large applications, improve the security and maintainability of Java SE Platform Implementations in general, and the JDK in particular and to improve application performance. However, this feature was developed under Project Jigsaw. Furthermore, this folder mainly contains java.base, java.desktop files & other .jmod files which are the replacements of jdk1.8/lib/tools.jar & jdk1.8/jre/lib/rt.jar. Therefore, you will not find tools.jar & rt.jar in jdk9.0 onward.
In fact, there is no jre sub-folder within jdk starting from jdk9.0 onward. jmods is now playing the rolls of jre.
The important difference of structure in JDK9.0 onward is the removal of jre directory & inclusion of jmods directory. However, the above described structure of JDK & differences in structure starting from jdk 9.0 onward is enough to know for a java techie. In order to have a deep research on JDK 9, we suggest to go through Oracle documentation.