Package com.day.util

Class JavaVersion

java.lang.Object
com.day.util.JavaVersion

public class JavaVersion extends 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

    Modifier and Type
    Method
    Description
    static String
    Returns the specification version of the current Java Runtime library.
    static String
    Returns the implementation version of the current Java Runtime library.
    static boolean
    Returns true if the specification version of the current Java Runtime library is 1.3.
    static boolean
    Returns true if the specification version of the current Java Runtime library is 1.4.
    static boolean
    Returns true if the specification version of the current Java Runtime library is 1.5.
    static boolean
    isCompatibleWith(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
    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
    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
    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
    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 Details

    • getVersion

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

      public static 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(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(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