Java Platform Module system


The Java Platform Module System (JPMS) is a code-level structure introduced in Java 9, which collects related packages together, thus making it easier to organize the code.

While Java’s top-level code organization element was the package until Java 9, and now, starting with Java 9 that has changed: as the module has replaced the package. The module system brings a new, higher-level descriptor which is added for use by JARs, incorporating the module-info.java file.

JPMS as the outcome of project Jigsaw, makes it easier for developers to organize large applications and libraries, to better handle the decomposition for more devices.

What JPMS brings to the Java Platform?



Given that JPMS is a Standard Edition feature, it therefore affects every aspect of Java and the change will allow most code to function without modification on moving from Java 8 to 9.

There are some exceptions, however and as the idea behind a module is to allow collection of related packages that are available to the module, while hiding the elements from external users of the module, which is to say that a module allows another level of encapsulation.

Above all, it will improve the structure and security of the platform and JDK itself, including the app performance.

Using Modules in the JDK



Now that the JDK itself is composed of modules, once you have JDK on your system, you'll also have the source.

Within your JDK install directory is a /lib directory and inside that directory is a src.zip file. Simply unzip the file into a /src directory and then, look inside the /src directory, navigating to the /java.base directory. There you'll find the module-info.java file. Open it!

And note that when running the Java compiler against modules, you'll need to specify the module path in like manner as the class path, as it allows the dependencies to be resolved.

Java Platform Module System (JPMS) makes organizing code easier

Java Platform Module system


The Java Platform Module System (JPMS) is a code-level structure introduced in Java 9, which collects related packages together, thus making it easier to organize the code.

While Java’s top-level code organization element was the package until Java 9, and now, starting with Java 9 that has changed: as the module has replaced the package. The module system brings a new, higher-level descriptor which is added for use by JARs, incorporating the module-info.java file.

JPMS as the outcome of project Jigsaw, makes it easier for developers to organize large applications and libraries, to better handle the decomposition for more devices.

What JPMS brings to the Java Platform?



Given that JPMS is a Standard Edition feature, it therefore affects every aspect of Java and the change will allow most code to function without modification on moving from Java 8 to 9.

There are some exceptions, however and as the idea behind a module is to allow collection of related packages that are available to the module, while hiding the elements from external users of the module, which is to say that a module allows another level of encapsulation.

Above all, it will improve the structure and security of the platform and JDK itself, including the app performance.

Using Modules in the JDK



Now that the JDK itself is composed of modules, once you have JDK on your system, you'll also have the source.

Within your JDK install directory is a /lib directory and inside that directory is a src.zip file. Simply unzip the file into a /src directory and then, look inside the /src directory, navigating to the /java.base directory. There you'll find the module-info.java file. Open it!

And note that when running the Java compiler against modules, you'll need to specify the module path in like manner as the class path, as it allows the dependencies to be resolved.

No comments