What is New Versioning Scheme in Java 9?

Since Java 9, versioning can be consistent with semantic versioning. The version number can be a non-empty sequence of strings separated by dots. It contains three major parts: major version number, minor version number, and security. The new versioning scheme has documented in Runtime. Version class and version information can be accessed from it.

The version numbers have the below format:

  • $MAJOR is the major version number and incremented when a major version has released that typically changes the platform specification. For JDK 9, this value is 9.
  • $MINOR is the minor version number and incremented for releases that contain bug fixes and enhancements to standard APIs.
  • $SECURITY is the security level and incremented for releases that contain critical security fixes. This version can't reset to zero when a minor version number has incremented.
  • $otherpart consists of one or more versions that have been used by JVM providers to indicate a patch with a small number of non-security fixes.

The version string can be a version number with some other information such as early-access release identifier or the build number:

  • $PRE is a pre-release identifier.
  • $BUILD is the build number.
  • $OPT is optional information such as a timestamp.


public class VersionSchemeTest {
   public static void main(String args[]) {
      System.out.println(Runtime.version().toString());  // String representation of the version  
      System.out.println(Runtime.version().major());  // major version number
      System.out.println(Runtime.version().minor());  // minor version number
      System.out.println(Runtime.version().security());  // security version number