The JDK's modularization

By now, you have a firm appreciation of Java's modularization. An old adage in Java, and another object-oriented programming language, is everything is a class. Now, everything is a module is a new adage. There are three types of modules, as explained here:

Module type Description
Automatic When a JAR is placed on a new module path, modules are automatically created.
Explicit/Named These modules are manually defined by editing the module-info.java file.
Unnamed When a JAR is placed on a classpath, unnamed modules are created.

 

When you migrate your applications from 8 or earlier, your application and its libraries become unnamed modules. So, you will need to ensure all the modules are in the module path. 

Another thing to be aware of is that your runtime image will not contain the entire JDK. Instead, it will only contain the modules your application requires. It is worth reviewing how the JDK is modularized in Java. The following table contains the API specification for the current JDK:

jdk.accessibility jdk.attach jdk.charsets jdk.compiler
jdk.crypto.cryptoki jdk.crypto.ec jdk.dynalink jdk.editpad
jdk.hotspot.agent jdk.httpserver jdk.incubator.httpclient jdk.jartool
jdk.javadoc jdk.jcmd jdk.jconsole jdk.jdeps
jdk.jdi jdk.jdwp.agent jdk.jlink jdk.jshell
jdk.jsobject jdk.jstatd jdk.localedata jdk.management
jdk.management.agent jdk.naming.dns jdk.naming.rmi jdk.net
jdk.pack jdk.packager.services jdk.policytool jdk.rmic
jdk.scripting.nashorn jdk.sctp jdk.security.auth jdk.security.jgss
jdk.snmp jdk.xml.dom  jdk.zipfs

The following table contains the API specification for Java SE:

java.activation java.base java.compiler java.corba
java.datatransfer java.desktop java.instrument java.logging
java.management java.management.rmi java.naming java.prefs
java.rmi java.scripting java.se java.se.ee
java.security.jgss java.security.sasl java.sql java.sql.rowset
java.transaction java.xml java.xml.bind java.xml.crypto
java.xml.ws java.xml.ws.annotation
Remember, all applications will have access to java.base as it is in the module path by default.

The following table contains the API specification for JavaFX in Java:

javafx.base javafx.controls javafx.fxml javafx.graphics
javafx.media javafx.swing javafx.web

 

There are two additional modules:

  • java.jnlp defines the API for JNLP (short for Java Network Launch Protocol).
  • java.smartcardio defines the API for the Java smart card input/output.
For details on any of these modules, visit Oracle's Java® Platform, Standard Edition Java Development Kit Version 10 API Specification website: http://docs.oracle.com/javase/10/docs/api/overview-summary.html.
..................Content has been hidden....................

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