What's new in JDK 9?

Java 9 features elucidated: JDK 9 Early Access documentation has been released

Gabriela Motroc

The image of door via Shutterstock

Oracle has released the Early Access documentation for JDK 9. It includes updated developer guides, migration assistance, and a list of new features in the release.

Oracle announced the release of the Early Access documentation for Oracle JDK 9, which includes updated developer guides, migration assistance, and a list of new features.

What’s new in JDK 9?

Oracle revealed that the most significant JDK 9 enhancement is the Java Platform Module System, which divides the JDK into a set of modules.

  • JEP 261: Module System, which implements the Java Platform Module System, as specified by JSR 376. There’s a new optional phase, link time, in between compile time and run time, during which a set of modules can be assembled and optimized into a custom runtime image. Furthermore, the tools javac, jlink, and java accept options to specify module paths, which locate definitions of modules. The list of changes also includes the modular JAR file (a JAR file with a module-info.class file in its root directory) and the JMOD format (a packaging format similar to JAR except it can include native code and configuration files)
  • JEP 200: The Modular JDK. It modularizes the Java Platform Module System as specified by JSR 376 and implemented by JEP 261. The modules can be combined into a variety of configurations including configurations corresponding to the JRE and the JDK, configurations roughly equivalent in content to each of the Compact Profiles defined in Java SE 8 and custom configurations that contain only a specified set of modules and their required modules.
  • JEP 220: Modular Run-Time Images. It restructures the JDK and JRE runtime images to accommodate modules and to improve performance, security, and maintainability. It also defines a new URI scheme for naming modules, classes, and resources stored in a runtime image without revealing the internal structure or format of the image and removes the endorsed-standards override mechanism and the extension mechanism. It also removes rt.jar and tools.jar from the Java runtime image.
  • JEP 260: Encapsulate Most Internal APIs makes most of the JDK’s internal APIs inaccessible by default but leaves a few critical, widely used internal APIs accessible until supported replacements exist for all or most of their functionality. If you want to find out if your code uses internal JDK APIs , run the command jdeps -jdkinternals. 

The list of changes also includes:

The format of the new version-string is as follows:

$MAJOR is the version number that is incremented for a major release, for example JDK 9, which contains significant new features as specified by the Java SE platform specification. A major release contains new features and changes to existing features, which are planned and notified well in advance.

$MINOR is the version number that is incremented for each minor update, such as bug fixes, revisions to standard APIs, or implementation of features outside the scope of the relevant platform specifications.

$SECURITY is the version number that is incremented for a security-update release, which contains critical fixes, including those necessary to improve security.

$PATCH is the version number that is incremented for a release containing security and high-priority customer fixes, which have been tested together.

Tools enhancements in JDK 9

The tools enhancements in JDK 9 are:

  • JEP 158: Unified JVM Logging introduces a common logging system for all components of the JVM.
  • JEP 214: Remove GC Combinations Deprecated in JDK 8 removes GC combinations that were deprecated in JDK 8. As a result, DefNew + CMS, ParNew + SerialOld and ncremental CMS no longer exist.The “foreground” mode for CMS has also been removed. These command line flags have been removed:
    • -Xincgc
    • -XX:+CMSIncrementalMode
    • -XX:+UseCMSCompactAtFullCollection
    • -XX:+CMSFullGCsBeforeCompaction
    • -XX:+UseCMSCollectionPassing

    The command line flag -XX:+UseParNewGC no longer has an effect. ParNew can only be used with CMS and CMS requires ParNew. Thus, the -XX:+UseParNewGC flag has been deprecated and will likely be removed in a future release.

  • JEP 222: jshell: The Java Shell (Read-Eval-Print Loop) adds Read-Eval-Print Loop (REPL) functionality to the Java platform. The jshell tool provides an interactive command-line interface for evaluating declarations, statements, and expressions of the Java programming language. It facilitates prototyping and exploration of coding options with immediate results and feedback. The immediate feedback combined with the ability to start with expressions is useful for education—whether learning the Java language or just learning a new API or language feature. The JShell API enables applications to leverage REPL functionality.
  • JEP 224: HTML5 Javadoc enhances the javadoc tool to enable the generation of HTML5 markup.
  • JEP 228: Add More Diagnostic Commands defines additional diagnostic commands to improve the ability to diagnose issues with Hotspot and the JDK.
  • JEP 231: Remove Launch-Time JRE Version Selection removes the ability to request a version of the JRE that is not the JRE being launched at launch time. Modern applications are typically deployed through Java Web Start (JNLP), native OS packaging systems, or active installers. These technologies have their own methods to manage the JREs needed by finding or downloading and updating the required JRE as needed. This makes the launcher’s Launch-Time JRE Version Selection obsolete.
  • JEP 240: Remove the JVM TI hprof Agent removes the hprof agent from the JDK (which was not intended to be a production tool). Furthermore, the useful features of the hprof agent have been superseded by better alternatives. However, it is still possible to create heap dumps in the hprof format using jmap or other diagnostic tools.
  • JEP 241: Remove the jhat Tool removes the jhat tool from the JDK. Oracle says it is out-of-date; superior heap visualizers and analyzers have been available for many years.
  • JEP 245: Validate JVM Command-Line Flag Arguments validates arguments to all numerical JVM command-line flags to avoid crashes and instead displays an appropriate error message if they are found to be invalid. Range and optional constraint checks have been implemented for arguments which require a user-specified numerical value.
  • JEP 247: Compile for Older Platform Versions enhances javac so that it can compile Java programs to run on selected older versions of the platform. When using the -source or -target options, the compiled program might accidentally use APIs that are not supported on the given target platform. The --release option will prevent accidental use of APIs.
  • JEP 282: jlink: The Java Linker adds a tool that assembles and optimizes a set of modules and their dependencies into a custom runtime image as defined in JEP 220. Defines a plugin mechanism for transformation and optimization during the assembly process, and for the generation of alternative image formats. Creates a custom runtime optimized for a single program. JEP 261 defines link time as an optional phase between the phases of compile time and run time. Link time requires a linking tool that assembles and optimizes a set of modules and their transitive dependencies to create a runtime image or executable.

Language changes in Java SE 9

JEP 213: Milling Project Coin identifies a few small changes:

  • Allow @SafeVargs on private instance methods.
  • Allow effectively-final variables to be used as resources in the try-with-resources statement.
  • Allow diamond with anonymous classes if the argument type of the inferred type is denotable.
  • Complete the removal, begun in Java SE 8, of underscore from the set of legal identifier names.
  • Add support for private interface methods.

If you’d like to find out what’s new in core libraries in JDK 9, what’s new for Javadoc or other features and enhancements, check out the beta draft of the Early Access documentation.

Gabriela Motroc
Gabriela Motroc was editor of and JAX Magazine. Before working at Software & Support Media Group, she studied International Communication Management at the Hague University of Applied Sciences.

Inline Feedbacks
View all comments