Top Description Fields Constructors Methods
org.junit.jupiter.api.condition

public final Enum JRE

extends Enum<JRE>
Class Inheritance
Annotations
@API
status:STABLE
since:5.1
Static Imports
org.apiguardian.api.API.Status.DEPRECATED, .API.Status.MAINTAINED, .API.Status.STABLE

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.

Since
5.1
See Also
JAVA_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, JAVA_26, OTHER, EnabledOnJre, DisabledOnJre, EnabledForJreRange, DisabledForJreRange

Field Summary

Modifier and TypeField and Description
private static final int
public static final JRE
JAVA_10

Deprecated for removal since 6.0. No longer supported at runtime; please use JAVA_17 or later
Java 10.
public static final JRE
JAVA_11

Deprecated for removal since 6.0. No longer supported at runtime; please use JAVA_17 or later
Java 11.
public static final JRE
JAVA_12

Deprecated for removal since 6.0. No longer supported at runtime; please use JAVA_17 or later
Java 12.
public static final JRE
JAVA_13

Deprecated for removal since 6.0. No longer supported at runtime; please use JAVA_17 or later
Java 13.
public static final JRE
JAVA_14

Deprecated for removal since 6.0. No longer supported at runtime; please use JAVA_17 or later
Java 14.
public static final JRE
JAVA_15

Deprecated for removal since 6.0. No longer supported at runtime; please use JAVA_17 or later
Java 15.
public static final JRE
JAVA_16

Deprecated for removal since 6.0. No longer supported at runtime; please use JAVA_17 or later
Java 16.
public static final JRE
JAVA_17

Java 17.

public static final JRE
JAVA_18

Java 18.

public static final JRE
JAVA_19

Java 19.

public static final JRE
JAVA_20

Java 20.

public static final JRE
JAVA_21

Java 21.

public static final JRE
JAVA_22

Java 22.

public static final JRE
JAVA_23

Java 23.

public static final JRE
JAVA_24

Java 24.

public static final JRE
JAVA_25

Java 25.

public static final JRE
JAVA_26

Java 26.

public static final JRE
JAVA_8

Deprecated for removal since 6.0. No longer supported at runtime; please use JAVA_17 or later
Java 8.
public static final JRE
JAVA_9

Deprecated for removal since 6.0. No longer supported at runtime; please use JAVA_17 or later
Java 9.
pack-priv static final int
public static final JRE
public static final JRE
UNDEFINED

An undefined JRE version.

pack-priv static final int
private final int

Constructor Summary

AccessConstructor and Description
private
JRE(int version)

Method Summary

Modifier and TypeMethod and Description
public static JRE

Returns:

the JRE for the currently executing JVM, potentially OTHER
currentJre
()

Returns the JRE for the currently executing JVM, potentially OTHER.

public static JRE

Returns:

the JRE for the currently executing JVM, potentially OTHER
currentVersion
()
Deprecated since 5.12. in favor of currentJre()

Returns the JRE for the currently executing JVM, potentially OTHER.

public static int

Returns:

the version number for the currently executing JVM, or -1 if the current JVM version could not be determined
currentVersionNumber
()

Returns the version number for the currently executing JVM, or -1 if the current JVM version could not be determined.

public boolean

Returns:

true if this JRE is known to be the Java Runtime Environment version for the currently executing JVM or if the version is OTHER
isCurrentVersion
()

Returns true if this JRE is known to be the Java Runtime Environment version for the currently executing JVM or if the version is OTHER.

public static boolean

Returns:

true if 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 -1 and the current JVM version could not be determined
isCurrentVersion
(int version)

Returns true if 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 -1 and the current JVM version could not be determined.

pack-priv static boolean
isCurrentVersionWithinRange(int min, int max)

public static JRE
public static JRE[]
public int

Returns:

the version of this JRE
version
()

Get the version of this JRE.

Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CURRENT_VERSIONback to summary
private static final int CURRENT_VERSION
JAVA_10back to summary
public static final JRE JAVA_10

Deprecated

for removal since 6.0.

No longer supported at runtime; please use JAVA_17 or later

Java 10.

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
JAVA_11back to summary
public static final JRE JAVA_11

Deprecated

for removal since 6.0.

No longer supported at runtime; please use JAVA_17 or later

Java 11.

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
JAVA_12back to summary
public static final JRE JAVA_12

Deprecated

for removal since 6.0.

No longer supported at runtime; please use JAVA_17 or later

Java 12.

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
Since
5.4
JAVA_13back to summary
public static final JRE JAVA_13

Deprecated

for removal since 6.0.

No longer supported at runtime; please use JAVA_17 or later

Java 13.

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
Since
5.4
JAVA_14back to summary
public static final JRE JAVA_14

Deprecated

for removal since 6.0.

No longer supported at runtime; please use JAVA_17 or later

Java 14.

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
Since
5.5
JAVA_15back to summary
public static final JRE JAVA_15

Deprecated

for removal since 6.0.

No longer supported at runtime; please use JAVA_17 or later

Java 15.

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
Since
5.6
JAVA_16back to summary
public static final JRE JAVA_16

Deprecated

for removal since 6.0.

No longer supported at runtime; please use JAVA_17 or later

Java 16.

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
Since
5.7
JAVA_17back to summary
public static final JRE JAVA_17

Java 17.

Annotations
@API
status:STABLE
since:5.7.1
Since
5.7.1
JAVA_18back to summary
public static final JRE JAVA_18

Java 18.

Annotations
@API
status:STABLE
since:5.8.1
Since
5.8.1
JAVA_19back to summary
public static final JRE JAVA_19

Java 19.

Annotations
@API
status:STABLE
since:5.9
Since
5.9
JAVA_20back to summary
public static final JRE JAVA_20

Java 20.

Annotations
@API
status:STABLE
since:5.9
Since
5.9
JAVA_21back to summary
public static final JRE JAVA_21

Java 21.

Annotations
@API
status:STABLE
since:5.9.2
Since
5.9.2
JAVA_22back to summary
public static final JRE JAVA_22

Java 22.

Annotations
@API
status:STABLE
since:5.10
Since
5.10
JAVA_23back to summary
public static final JRE JAVA_23

Java 23.

Annotations
@API
status:STABLE
since:5.11
Since
5.11
JAVA_24back to summary
public static final JRE JAVA_24

Java 24.

Annotations
@API
status:STABLE
since:5.11
Since
5.11
JAVA_25back to summary
public static final JRE JAVA_25

Java 25.

Annotations
@API
status:STABLE
since:5.11.4
Since
5.11.4
JAVA_26back to summary
public static final JRE JAVA_26

Java 26.

Annotations
@API
status:STABLE
since:5.13.2
Since
5.13.2
JAVA_8back to summary
public static final JRE JAVA_8

Deprecated

for removal since 6.0.

No longer supported at runtime; please use JAVA_17 or later

Java 8.

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
JAVA_9back to summary
public static final JRE JAVA_9

Deprecated

for removal since 6.0.

No longer supported at runtime; please use JAVA_17 or later

Java 9.

Annotations
@API
status:DEPRECATED
since:6.0
@Deprecated
since:6.0
forRemoval:true
MINIMUM_VERSIONback to summary
pack-priv static final int MINIMUM_VERSION
OTHERback to summary
public static final JRE OTHER

A JRE version other than JAVA_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, or JAVA_26.

This constant returns Integer#MAX_VALUE for its version. To retrieve the actual version number, use currentVersionNumber().

UNDEFINEDback to summary
public static final JRE UNDEFINED

An undefined JRE version.

This constant is used by JUnit as a default configuration value but is not intended to be used by users.

This constant returns -1 for its version.

Annotations
@API
status:MAINTAINED
since:5.13.3
Since
5.12
UNDEFINED_VERSIONback to summary
pack-priv static final int UNDEFINED_VERSION
versionback to summary
private final int version

Constructor Detail

JREback to summary
private JRE(int version)

Method Detail

currentJreback to summary
public static JRE currentJre()

Returns the JRE for the currently executing JVM, potentially OTHER.

Returns:JRE

the JRE for the currently executing JVM, potentially OTHER

Annotations
@API
status:STABLE
since:5.12
Since
5.12
See Also
currentVersionNumber()
currentVersionback to summary
public static JRE currentVersion()

Deprecated

since 5.12.

in favor of currentJre()

Returns the JRE for the currently executing JVM, potentially OTHER.

Returns:JRE

the JRE for the currently executing JVM, potentially OTHER

Annotations
@API
status:DEPRECATED
since:5.12
@Deprecated
since:5.12
Since
5.7
See Also
currentVersionNumber()
currentVersionNumberback to summary
public static int currentVersionNumber()

Returns the version number for the currently executing JVM, or -1 if the current JVM version could not be determined.

Returns:int

the version number for the currently executing JVM, or -1 if the current JVM version could not be determined

Annotations
@API
status:MAINTAINED
since:5.13.3
Since
5.12
See Also
Runtime.Version#feature(), currentJre()
isCurrentVersionback to summary
public boolean isCurrentVersion()

Returns true if this JRE is known to be the Java Runtime Environment version for the currently executing JVM or if the version is OTHER.

Returns:boolean

true if this JRE is known to be the Java Runtime Environment version for the currently executing JVM or if the version is OTHER

See Also
currentJre(), currentVersionNumber()
isCurrentVersionback to summary
public static boolean isCurrentVersion(int version)

Returns true if 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 -1 and the current JVM version could not be determined.

Returns:boolean

true if 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 -1 and the current JVM version could not be determined

Annotations
@API
status:MAINTAINED
since:5.13.3
Since
5.12
See Also
Runtime.Version#feature()
isCurrentVersionWithinRangeback to summary
pack-priv static boolean isCurrentVersionWithinRange(int min, int max)
valueOfback to summary
public static JRE valueOf(String name)
valuesback to summary
public static JRE[] values()
versionback to summary
public int version()

Get the version of this JRE.

If this JRE is UNDEFINED, this method returns -1. If this JRE is OTHER, this method returns Integer#MAX_VALUE.

Returns:int

the version of this JRE

Annotations
@API
status:MAINTAINED
since:5.13.3
Since
5.12
See Also
Runtime.Version#feature(), currentVersionNumber()