Class JavaVersion


  • public final class JavaVersion
    extends java.lang.Object
    Utility to check the major Java version of the current JVM.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int majorJavaVersion  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private JavaVersion()  
    • Field Detail

      • majorJavaVersion

        private static final int majorJavaVersion
    • Constructor Detail

      • JavaVersion

        private JavaVersion()
    • Method Detail

      • determineMajorJavaVersion

        private static int determineMajorJavaVersion()
      • parseMajorJavaVersion

        static int parseMajorJavaVersion​(java.lang.String javaVersion)
      • parseDotted

        private static int parseDotted​(java.lang.String javaVersion)
      • extractBeginningInt

        private static int extractBeginningInt​(java.lang.String javaVersion)
      • getMajorJavaVersion

        public static int getMajorJavaVersion()
        Gets the major Java version
        Returns:
        the major Java version, i.e. '8' for Java 1.8, '9' for Java 9 etc.
      • isJava9OrLater

        public static boolean isJava9OrLater()
        Gets a boolean value depending if the application is running on Java 9 or later
        Returns:
        true if the application is running on Java 9 or later; and false otherwise.