Enum JRE
- All Implemented Interfaces:
Serializable, Comparable<JRE>, java.lang.constant.Constable
Enumeration of Java Runtime Environment (JRE) versions.
If the current JRE version can be detected but is not one of the predefined
constants in this enum, OTHER will be considered to be the
current JRE version. If the current JRE version
cannot be detected — for example, if the java.version JVM system
property is undefined — UNDEFINED will be considered to be the
current JRE version.
- Since:
- 5.1
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionJava 10.Java 11.Java 12.Java 13.Java 14.Java 15.Java 16.Java 17.Java 18.Java 19.Java 20.Java 21.Java 22.Java 23.Java 24.Java 25.Java 26.Java 8.Java 9.An undefined JRE version. -
Method Summary
Modifier and TypeMethodDescriptionstatic JREstatic JREDeprecated.static intbooleanstatic booleanisCurrentVersion(int version) static JREReturns the enum constant of this type with the specified name.static JRE[]values()Returns an array containing the constants of this enum type, in the order they are declared.intversion()Get the version of thisJRE.
-
Enum Constant Details
-
UNDEFINED
-
JAVA_8
Java 8. -
JAVA_9
Java 9. -
JAVA_10
Java 10. -
JAVA_11
Java 11. -
JAVA_12
-
JAVA_13
-
JAVA_14
-
JAVA_15
-
JAVA_16
-
JAVA_17
-
JAVA_18
-
JAVA_19
-
JAVA_20
-
JAVA_21
-
JAVA_22
-
JAVA_23
-
JAVA_24
-
JAVA_25
-
JAVA_26
-
OTHER
A JRE version other thanJAVA_8,JAVA_9,JAVA_10,JAVA_11,JAVA_12,JAVA_13,JAVA_14,JAVA_15,JAVA_16,JAVA_17,JAVA_18,JAVA_19,JAVA_20,JAVA_21,JAVA_22,JAVA_23,JAVA_24,JAVA_25, orJAVA_26.This constant returns
Integer.MAX_VALUEfor its version. To retrieve the actual version number, usecurrentVersionNumber().
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
version
@API(status=MAINTAINED, since="5.13.3") public int version()Get the version of thisJRE.If this
JREisUNDEFINED, this method returns-1. If thisJREisOTHER, this method returnsInteger.MAX_VALUE.- Returns:
- the version of this
JRE - Since:
- 5.12
- See Also:
-
isCurrentVersion
-
currentVersion
Deprecated.in favor ofcurrentJre() -
currentJre
-
currentVersionNumber
@API(status=MAINTAINED, since="5.13.3") public static int currentVersionNumber()- Returns:
- the version number for the currently executing JVM, or
-1if the current JVM version could not be determined - Since:
- 5.12
- See Also:
-
isCurrentVersion
@API(status=MAINTAINED, since="5.13.3") public static boolean isCurrentVersion(int version) - Returns:
trueif the supplied version number is known to be the Java Runtime Environment version for the currently executing JVM or if the supplied version number is-1and the current JVM version could not be determined- Since:
- 5.12
- See Also:
-
currentJre()