Java 9 Module System

Java 9 has one of the major changes in its features which is the Java module System. The main aim of the system is to collect Java packages and code to be collected into a single unit called a Module. The reason to add this feature in Java is that when we want to create modular applications using Java the earlier versions before 9 have no system like this that’s why the size of the application has increased. Even the JDK file in the earlier version of Java has a large size only the rt.jar file size was around 64 MB.

To avoid this situation Java 9 has split the JDK into a set of modules. so that we can use the required module to develop our application. Apart from this, the Java 9 version has also provided a feature so that the user could create their own module and develop their own applications.

The modules in Java have the below options mentioned:

  • This version of Java includes various options for Java tools such as javac and java etc. In which we can specify the module path and help us to locate the location of the module in the Java 9.
  • The JAR [ java Archive] file was introduced in this version of java. The JAR contains module-info.class file in the folder. [ JAR is a file format which is a zip file which is used for aggregation of many files into one ]
  • As we specified earlier the earlier versions of java has no modular system and the size of rt.jar file was large so the JDK and JRE was split into modules so that we can use the modules we want to develop our application.
  • Another thing is that the java 9 has introduced a new URL method for naming the class and modules.
  • JMOD file format is also introduced which is used to handle other configuration files in java.

Java Modules

Java Module System provides an additional layer of encapsulation to our programs as we can specify which package can be utilized by the modules, and which modules could have entry to to them. Before entering into the exclusive types of modules in Java, we will first learn the differences among applications and modules. We recognize that there are numerous applications in Java including IO bundle, AWT package, swing bundle, and so on.

Similar Reads

Difference Between Module and Package

The principal difference between the module and package is given below....

Java 9 Module System

Java 9 has one of the major changes in its features which is the Java module System. The main aim of the system is to collect Java packages and code to be collected into a single unit called a Module. The reason to add this feature in Java is that when we want to create modular applications using Java the earlier versions before 9 have no system like this that’s why the size of the application has increased. Even the JDK file in the earlier version of Java has a large size only the rt.jar file size was around 64 MB....

Java 9 Module

The collection of packages and code into a single unit is called module . The module can be described with the help of module descriptor which is named by module-info.java and the module declarator describes the below three that were shown in the image....

How to Create a module in java?

Earlier we supposed that our java module name is org.geeksforgeeks which has followed the reverse domain pattern to overcome the naming conflicts....

Contact Us