Java 9 Debuts With Jigsaw Modular Approach At JavaOne

The long, slow process of building new Java releases is getting a major overhaul in Java 9 as project Jigsaw finally lands

The Java Platform Standard Edition (Java SE) version 9 is now generally available bringing with it a number of new features to help make Java more modular and efficient.

At the JavaOne conference in San Francisco on Oct. 2, Mark Reinhold Chief Architect, Java Platform Group at Oracle outlined some of the new Java 9 enhancements and provided insight on what’s next.

“Java 9 is here,” Reinhold said. “That means that Jigsaw is here.”

Project Jigsaw is an effort that Oracle has been talking about since September 2010, just after the company completed its’ acquisition of Sun Microsystems. Jigsaw is an effort to turn Java into a more modular stack, including a module subsystem to help make the programming language more efficient.

java spill breach

Oracle Java 9

 Classpath is a parameter that specifies the location of classes and packages for a Java Virtual Machine (JVM) or a Java compiler, while the Java Development Kit (JDK) is the development environment for building Java applications. In Java 9, thanks to Jigsaw there is now a modular system that  replaces Classpath, as a more optimized, developer-intuitive model to specify package and library locations.
 

“The module system helps developers to escape from classpath hell because it provides a cleaner and safer alternative,” Reinhold said.

Reinhold added that when jar (Java ARchive) files are used, the modular system guarantees certain properties to developers when compiling or running code that can’t even be expressed in the classpath system. The first property that the Java 9 module system guarantees is reliable configuration.

“Reliable configuration means that if one module requires another, then that other module will be present and none of the modules that are present will conflict with any others,” Reinhold said.

The second core guarantee made by the new module system in Java 9 is strong encapsulation. Reinhold explained that with strong encapsulation, the code that is outside of a specific module can only access the classes and interfaces in the packages that have been explicitly exported by the module.

“This means you can conceal your internal APIs and change them whenever you want to,” Reinhold said.

JDK Refactoring

Overall Java 9 is likely to be significantly smaller for developers, thanks to the module system and a refactoring of the JDK itself to be more scaleable. Reinhold said that Oracle has taken the module system and applied to the Java platform itself as well.

“After years of painstaking refactoring, we have managed to divide the system up into a set of 26 standard Java SE modules,” Reinhold said.

So now instead of requiring a large monolithic installation to enable Java development, Reinhold said that with Java 9, developers can choose more optimized configurations. Using a new JDK configuration option called jlink, developers can now configure a customized runtime system that only uses the Java modules they need.

Reinhold noted that there are many new features in Java 9 and he doesn’t expect developers to embrace them overnight.

“It has been a long road to deliver Jigsaw and it will be a long road  to its wide adoption and that’s fine,” Reinhold said. “Many of you will make use of the new modular nature of Java 9 long before you use the module system in your own code.

Java 10

Looking beyond Java 9, Oracle has committed to a new development approach for what would have been called Java 10. Reinhold said that over the last 20 years, Java has evolved in large, irregular and somewhat unpredictable steps.

“Java needs to move forward faster,” Reinhold said “‘We’re now going to have a new release every six months on a strict time based model and features only go in when ready.”

The next major release of Java, will likely be named Java 18.3 and will be available in March 2018 and is set to be followed six months later with another release in September 2018. Reinhold said that there is already a pipeline of features big and small on the roadmap that will land in the new Java release model.

“We hope that all of this work will not just keep Java moving forward, but moving forward faster,” Reinhold said.

 “In Project Jigsaw we set out to solve two fundamental problems in the Java platform,” Reinhold said. “One is the brittle and error prone Classpath, the other is the massive and monolithic JDK.”
 
Originally published on eWeek