Sunday, January 25, 2015

Java Evolution: JDK and JRE File Structure

"JDK and JRE File Structure" describes the most important files and directories required to develop applications for the Java platform. In [1], it states that there will be new changes in coming Java 9 such as:
  • JRE and JDK images now have identical structures.
    • Previously a JDK image embedded the JRE in a jre subdirectory; now a JDK image is simply a run-time image that happens to contain the full set of development tools and other items historically found in the JDK.
  • The internal files rt.jar, tools.jar, and dt.jar have been removed.
  • The extension mechanism has been removed.
  • The endorsed-standards override mechanism has been removed.

In this article, we will take one step back to see how "JDK and JRE File Structure" has evolved from Java 6 to 8. Note that the file structure of the JRE is identical to that of the JDK's jre directory.

Java 6


Assuming the JDK software is installed at /jdk1.6.0, here are some of the most important directories:[2]


               jdk1.6.0
        ___________|____________________ ________________________
       |           |                    |                        |
      bin         lib                  jre                     include     
       |           |          __________|_____________________
   java.exe    tools.jar     |                                |        
   javac.exe   dt.jar       bin                              lib                
   javap.exe            _____|____ __________         ________|_______ ________ ________        
   javah.exe           |          |          |       |        |       |        |        |
   javadoc.exe     java.exe    client      server  rt.jar    ext  security  applet    fonts
                   java.dll       |          |   charsets.jar |                  
                   awt.dll     jvm.dll    jvm.dll        localedata.jar      

Java 7


As part of the Java 7 release, the Java Development Kit (JDK) now includes the SDK for developing JavaFX applications and, more importantly, the JavaFX Runtime is now installed with the JRE.[3] In addition, there is new db sub-folder under the root directory of JDK software installation.

Assuming the JDK software is installed at /jdk1.7.0, here are some of the most important directories:[4]


               jdk1.7.0
        ___________|____________________ __________________________ _______
       |           |                    |                          |       |

      bin         lib                  jre                      include    db
       |           |          __________|________________________
   java.exe  ant-javafx.jar  |                                   |        
   javac.exe   dt.jar       bin                                 lib                
   javap.exe tools.jar  _____|____ __________          __________|_______ ________ ________        
   javah.exe           |          |          |        |          |       |        |        |
   javadoc.exe     java.exe    client      server   rt.jar      ext  security  applet    fonts
                   java.dll       |          |    charsets.jar   |                  
                   awt.dll     jvm.dll    jvm.dll   jfxrt.jar  localedata.jar      

Java 8


In Java 8, jfxrt.jar has become one of the optional packages (what used to be known as standard extensions).[6] So, it has been moved into /lib/ext.

Assuming the JDK software is installed at /jdk1.8.0, here are some of the most important directories:


               jdk1.8.0
        ___________|____________________ __________________________ _______
       |           |                    |                          |       |

      bin         lib                  jre                      include    db
       |           |          __________|________________________
   java.exe  ant-javafx.jar  |                                   |        
   javac.exe   dt.jar       bin                                 lib                
   javap.exe tools.jar  _____|____ __________          __________|_______ ________ ________        
   javah.exe           |          |          |        |          |       |        |        |
   javadoc.exe     java.exe    client      server   rt.jar      ext  security  applet    fonts
                   java.dll       |          |    charsets.jar   |                  
                   awt.dll     jvm.dll    jvm.dll              localedata.jar    
                                                               jfxrt.jar

Directory Summary


Directory
Contains
Setup
<jdk1.x.0>/bin
Executables for all the development tools contained in the JDK.
The PATH environment variable should contain an entry for this directory.
<jdk1.x.0>/lib Files used by the development tools.
<jdk1.x.0>/jre Root directory of the Java Runtime Environment (JRE) used by the JDK development tools. This is the directory referred to by the java.home system property.
<jdk1.x.0>/jre/bin Executable files for tools and libraries used by the Java platform.
The executable files are identical to files in /jdk1.x.0/bin.

This directory does not need to be in the PATH environment variable.
<jdk1.x.0>/jre/lib Code libraries, property settings, and resource files used by the JRE.
<jdk1.x.0>/jre/lib/ext Default installation directory for extensions to the Java platform.
See The Extension Mechanism
<jdk1.x.0>/jre/lib/security Contains files used for security management. These include the security policy java.policy and security properties java.security files.
<jdk1.x.0>/jre/lib/amd64 Contains the .so (shared object) files used by the architecture amd64 release of the Java platform

<jdk1.x.0>/jre/lib/amd64/server Contains the .so file used by the Java HotSpot VM server.
<jdk1.x.0>/jre/lib/applet JAR files that contain support classes for applets can be placed in the lib/applet/ directory.
This reduces startup time for large applets by allowing applet classes to be preloaded from the local file system by the applet class loader and provides the same protections as though they had been downloaded over the Internet.

<jdk1.x.0>/jre/lib/fonts Font files used by the platform.


References

  1. Project Jigsaw: Modular run-time images
  2. JDK and JRE File Structure (Java 6, Linux version)
  3. Java 7 Now Includes JavaFX
  4. JDK and JRE File Structure (Java 7, Linux version)
  5. JDK and JRE File Structure (Java 8, Linux version)
  6. Extension Mechanism Architecture
  7. WebLogic's Classloading Framework (Xml and More)
  8. java.lang.UnsatisfiedLinkError: Setting Environment Variable (Xml and More)
  9. Compatibility Guide for JDK 8

No comments: