Package com.day.util
Class JavaVersion
- java.lang.Object
-
- com.day.util.JavaVersion
-
public class JavaVersion extends java.lang.Object
TheJavaVersion
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()
Returnstrue
if the specification version of the current Java Runtime library is1.3
.static boolean
is14()
Returnstrue
if the specification version of the current Java Runtime library is1.4
.static boolean
is15()
Returnstrue
if the specification version of the current Java Runtime library is1.5
.static boolean
isCompatibleWith(java.lang.String specVersion)
Returnstrue
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()
Returnstrue
if the specification version of the current Java Runtime library is compatible with1.3
, that is if the specification version of the current Java Runtime library is the same or newer than1.3
.static boolean
isCompatibleWith14()
Returnstrue
if the specification version of the current Java Runtime library is compatible with1.4
, that is if the specification version of the current Java Runtime library is the same or newer than1.4
.static boolean
isCompatibleWith15()
Returnstrue
if the specification version of the current Java Runtime library is compatible with1.5
, that is if the specification version of the current Java Runtime library is the same or newer than1.5
.static boolean
isSpecificationVersion(java.lang.String specVersion)
Returnstrue
if the specification version of the current Java Runtime library the given version string.
-
-
-
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()
Returnstrue
if the specification version of the current Java Runtime library is1.3
. This is a convenience method completely equivalent toisSpecificationVersion("1.3")
.- Returns:
- if it is the version
-
is14
public static boolean is14()
Returnstrue
if the specification version of the current Java Runtime library is1.4
. This is a convenience method completely equivalent toisSpecificationVersion("1.4")
.- Returns:
- if it is the version
-
is15
public static boolean is15()
Returnstrue
if the specification version of the current Java Runtime library is1.5
. This is a convenience method completely equivalent toisSpecificationVersion("1.5")
.- Returns:
- if it is the version
-
isSpecificationVersion
public static boolean isSpecificationVersion(java.lang.String specVersion)
Returnstrue
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()
Returnstrue
if the specification version of the current Java Runtime library is compatible with1.3
, that is if the specification version of the current Java Runtime library is the same or newer than1.3
. This is a convenience method completely equivalent toisCompatibleWith("1.3")
.- Returns:
- if it is compatible
-
isCompatibleWith14
public static boolean isCompatibleWith14()
Returnstrue
if the specification version of the current Java Runtime library is compatible with1.4
, that is if the specification version of the current Java Runtime library is the same or newer than1.4
. This is a convenience method completely equivalent toisCompatibleWith("1.4")
.- Returns:
- if it is compatible
-
isCompatibleWith15
public static boolean isCompatibleWith15()
Returnstrue
if the specification version of the current Java Runtime library is compatible with1.5
, that is if the specification version of the current Java Runtime library is the same or newer than1.5
. This is a convenience method completely equivalent toisCompatibleWith("1.5")
.- Returns:
- if it is compatible
-
isCompatibleWith
public static boolean isCompatibleWith(java.lang.String specVersion)
Returnstrue
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
-
-