Platform modularity

With Java 9, the entire Java platform, with every class in it, has been segregated and grouped into modules. Yes, all of the platform Java classes from Collections and Thread to Connection and Logger! It doesn't really matter which one; every platform class is now housed in newly created Java modules that come out-of-the-box with the runtime and the JDK. The platform team achieved this by going through both the public APIs and internal classes, grouping them based on the types that usually go well together and are self-contained, and bundling such related classes into modules.

Take Java logging for example. The native logging functionality in Java comprised of a group of classes in the package java.util.logging. These classes have now been grouped into a newly created module called java.logging. The JDBC and SQL related classes have all gone into a new module called java.sql. XML related classes have gone into the module java.xml. Here are a few more examples of modules that come out-of-the-box with Java 9:

  • java.scripting: Provides the scripting APIs for the Java scripting engine
  • java.desktop: Provides the Java desktop APIs, awt, and swing packages
  • java.transaction: Provides transaction related APIs in package javax.transaction

There is also a special module named java.base. The module java.base contains APIs and classes that are fundamental to the Java platform and without which one could not possibly write any Java code. The java.base module contains APIs from packages such as java.lang, java.io, java.util and so on. As you can see, it covers a lot of basic Java APIs that most of our Java applications use. Now, why do I call this module special? Hold that thought! We'll get back to it in a bit.

..................Content has been hidden....................

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