Introduction to Java 9 Module System Jigsaw Project
Posted By : Anil Kumar Maurya | 31-Jan-2019
As we know, Java SE 8 came with three big new features (plus few more enhancements and new features) i.e Lambda Expressions, Stream API and Date API. In the same way, Java SE 9 is coming with three big features (plus a few more enhancements and new features) i.e. Java Module System (Jigsaw Project), Java REPL, Milling Project Coin. In this post, we will talk about Oracle Jigsaw project basics.
Main Goals of Jigsaw Project:
The Modular JDK: Dividing JDK itself into small modules to get a number of benefits.
Modular Source Code: Dividing Java Source code into smaller modules.
Modular Run-Time Images: Restructuring the JDK and JRE run-time images to accommodate modules.
Encapsulate APIs: Make most of the JDK’s internal APIs inaccessible by default but leave a few critical, widely-used internal APIs accessible.
Java Platform Module System: Allowing the user to create their modules to develop their applications.
Problems of Current Java System(Java 8 or older version)
1. As JDK is too big, it is a bit tough to scale down to small devices. There have 3 types of compact profiles to solve this problem: compact1, compact2, and compact3. But it does not solve this problem.
2. JAR files like rt.jar etc are too big to use in small devices and applications.
3. As JDK is too big, our applications or devices are not able to support better Performance.
4. There is no Strong Encapsulation in the current Java System because “public” access modifier is too open. Everyone can access it.
5. As of JDK, JRE is too big, it is hard to Test and Maintain applications.
6. As the public is too open, They are not to avoid the accessing of some Internal Non-Critical APIs like the sun.*, *.internal.* etc.
7. As User can access Internal APIs too, Security is also a big issue.
Advantages of Java SE 9 Module System
1. As Java SE 9 is going to divide JDK, JRE, JARs etc, into smaller modules, we can use whatever modules we want. It will be very easy to scale down the Java Application to Small devices.
2. Ease of Testing and Maintainability.
3. Supports better Performance.
4. As the public is not just public, it supports very Strong Encapsulation.
5. We cannot access Internal Non-Critical APIs anymore.
6. Modules can hide unwanted and internal details very safely, we can get better Security.
7. The application is too small because we can use only whatever modules we want.
8. It's easy to support Less Coupling between components.
9. It's easy to support the Single Responsibility Principle (SRP).
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Anil Kumar Maurya
Anil is an experienced Lead with core knowledge of Java, Spring, and SQL. He has good working experience in banking, finance and trading domain.