Examining platform file structure

Let's now examine how these changes to the platform manifest in the file structure of the installation. Historically, the Java platform has come in two flavors--The Java Runtime environment (JRE) and the Java Development Kit (JDK). The JDK is the superset, in that it contains the JRE. Here's a high-level structure of the classic JDK with only a few important files shown for the sake of simplicity:

The Java 9 JDK looks very different. You can navigate to the directory using the cd $JAVA_HOME command. Here's what the new JDK looks like, again with only a few important files displayed:

There are a couple of important differences that should be noted:

  • There is no JRE folder within the main folder anymore. The structure is now collapsed into one common folder. JDK 9 moves away from the distinction between JRE and JDK to create a common runtime binary file structure. This structure contains the bin, lib, and conf folders at the top level, with no nested folders for the runtime. This change was implemented to provide the ability to create custom runtime images that are now supported in Java 9. You'll learn more about generating such images in Chapter 8, Understanding Linking and Using jlink.
  • There's a new folder called jmods that contains all the packaged platform modules that we've learnt about so far. With Java 9, it's time to say goodbye to rt.jar. There is no single monolithic jar file that houses the entire platform. Each platform module has a corresponding file in the jmods folder. So, what would have formerly been a single rt.jar file is now split into separate module files, one for each platform module.
  • Notice the .jmod file extension of the module files. Shouldn't those be .jar files? With Java 9, a new format called JMOD has been introduced as a new way of bundling libraries specifically for development time, and not for runtime. The traditional jar format is great for bundling classes for runtime use, but since they are just a ZIP file of compiled classes, they aren't very useful when using them during development time. The new JMOD format goes beyond the JAR format by including the ability to bundle in things such as native code and configuration files, which makes it useful for distributing libraries for development use. This is the format used by the JDK to bundle all built-in platform modules. The details of the format are beyond the scope of what we are covering here. Just think of it as the new dev-time-only alternative to the JAR format.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.69.199