Package com.day.util

Class JavaVersion


  • public class JavaVersion
    extends java.lang.Object
    The JavaVersion class is a helper class to handle various Java version strings and query about the version of the Java VM the application is running.

    The version information provided is based on the Java Runtime of the currently running Virtual Machine.

    This is a utility class, which cannot be instantiated.

    Since:
    hawk
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getSpecificationVersion()
      Returns the specification version of the current Java Runtime library.
      static java.lang.String getVersion()
      Returns the implementation version of the current Java Runtime library.
      static boolean is13()
      Returns true if the specification version of the current Java Runtime library is 1.3.
      static boolean is14()
      Returns true if the specification version of the current Java Runtime library is 1.4.
      static boolean is15()
      Returns true if the specification version of the current Java Runtime library is 1.5.
      static boolean isCompatibleWith​(java.lang.String specVersion)
      Returns true if the specification version of the current Java Runtime library is compatible with the given specification version, that is if the specification version of the current Java Runtime library is the same or newer than the given version.
      static boolean isCompatibleWith13()
      Returns true if the specification version of the current Java Runtime library is compatible with 1.3, that is if the specification version of the current Java Runtime library is the same or newer than 1.3.
      static boolean isCompatibleWith14()
      Returns true if the specification version of the current Java Runtime library is compatible with 1.4, that is if the specification version of the current Java Runtime library is the same or newer than 1.4.
      static boolean isCompatibleWith15()
      Returns true if the specification version of the current Java Runtime library is compatible with 1.5, that is if the specification version of the current Java Runtime library is the same or newer than 1.5.
      static boolean isSpecificationVersion​(java.lang.String specVersion)
      Returns true if the specification version of the current Java Runtime library the given version string.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getVersion

        public static java.lang.String getVersion()
        Returns the implementation version of the current Java Runtime library. E.g. "1.4.2_04"
        Returns:
        the version
      • getSpecificationVersion

        public static java.lang.String getSpecificationVersion()
        Returns the specification version of the current Java Runtime library. E.g. "1.4"
        Returns:
        the version
      • is13

        public static boolean is13()
        Returns true if the specification version of the current Java Runtime library is 1.3. This is a convenience method completely equivalent to isSpecificationVersion("1.3").
        Returns:
        if it is the version
      • is14

        public static boolean is14()
        Returns true if the specification version of the current Java Runtime library is 1.4. This is a convenience method completely equivalent to isSpecificationVersion("1.4").
        Returns:
        if it is the version
      • is15

        public static boolean is15()
        Returns true if the specification version of the current Java Runtime library is 1.5. This is a convenience method completely equivalent to isSpecificationVersion("1.5").
        Returns:
        if it is the version
      • isSpecificationVersion

        public static boolean isSpecificationVersion​(java.lang.String specVersion)
        Returns true if the specification version of the current Java Runtime library the given version string.
        Parameters:
        specVersion - The specification version to compare to the specification of the current Hava Runtime library.
        Returns:
        if it is the version
      • isCompatibleWith13

        public static boolean isCompatibleWith13()
        Returns true if the specification version of the current Java Runtime library is compatible with 1.3, that is if the specification version of the current Java Runtime library is the same or newer than 1.3. This is a convenience method completely equivalent to isCompatibleWith("1.3").
        Returns:
        if it is compatible
      • isCompatibleWith14

        public static boolean isCompatibleWith14()
        Returns true if the specification version of the current Java Runtime library is compatible with 1.4, that is if the specification version of the current Java Runtime library is the same or newer than 1.4. This is a convenience method completely equivalent to isCompatibleWith("1.4").
        Returns:
        if it is compatible
      • isCompatibleWith15

        public static boolean isCompatibleWith15()
        Returns true if the specification version of the current Java Runtime library is compatible with 1.5, that is if the specification version of the current Java Runtime library is the same or newer than 1.5. This is a convenience method completely equivalent to isCompatibleWith("1.5").
        Returns:
        if it is compatible
      • isCompatibleWith

        public static boolean isCompatibleWith​(java.lang.String specVersion)
        Returns true if the specification version of the current Java Runtime library is compatible with the given specification version, that is if the specification version of the current Java Runtime library is the same or newer than the given version.
        Parameters:
        specVersion - The specification version to compare to the specification of the current Hava Runtime library.
        Returns:
        if it is compatible