Posts

Showing posts with the label Java 9 modules

Java 9 Modules Introduction Explained in Brief

Java 9 Modules are one of the new features added by Java 9. This is a 3 part article, in which I will be covering modules in detail. In part 1 of this article, I will be introducing you to modules. See also Modules Internals and Creating a Module . What are modules Modules are basically groups of packages . Just like you put a set of related classes into a package, you can put a set of related packages into a module. This helps to organize code better and to follow the Single Responsibility Principle (SRP).  So all the packages in a single module help to achieve a single functionality. Why they were added Prior to Java 9, there was no concept of modules. So the core jar files related to JDK like rt.jar was very big in size and it was not possible to use them on smaller devices. Also, with JDK 9 and before, developers could access internal JDK files so security was an issue. Java 9 modules help to overcome both these issues. With modules, the JDK is now organised so that the internal J...