Class JDK


  • public final class JDK
    extends Object
    A simple class that fills a hole in the JDK. It parses out the version numbers of the JDK we are running. Example:

    1.6.0_u14 == major = 1 minor = 6, subminor = 0, update = 14

    Author:
    bnevins
    • Constructor Detail

      • JDK

        public JDK()
    • Method Detail

      • isRunningLTSJDK

        public static boolean isRunningLTSJDK()
        See if the current JDK is an LTS version
        Returns:
        true if JDK is an LTS version (8, 11, 17, 21, 25, 29...)
      • ok

        public static boolean ok()
        See if the current JDK is legal for running GlassFish
        Returns:
        true if the JDK is >= 11
      • getMajor

        public static int getMajor()
      • getMinor

        public static int getMinor()
      • getSubMinor

        public static int getSubMinor()
      • getUpdate

        public static int getUpdate()
      • getVendor

        public static String getVendor()
      • getVm

        public static String getVm()
      • isCorrectJDK

        public static boolean isCorrectJDK​(Optional<JDK.Version> reference,
                                           Optional<String> vendorOrVM,
                                           Optional<JDK.Version> minVersion,
                                           Optional<JDK.Version> maxVersion)
        Check if the reference version falls between the minVersion and maxVersion.
        Parameters:
        reference - The version to compare; falls back to the current JDK version if empty.
        vendorOrVM - The inclusive JDK vendor or VM name.
        minVersion - The inclusive minimum version.
        maxVersion - The inclusive maximum version.
        Returns:
        true if within the version range, false otherwise
      • toStringStatic

        public static String toStringStatic()
        No instances are allowed so it is pointless to override toString
        Returns:
        Parsed version numbers