Skip to content

[Backport 3.0] Update JavaVersionChecker to enforce min of JDK21 #18038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 3.0
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
import java.util.Locale;

/**
* Simple program that checks if the runtime Java version is at least 11
* Simple program that checks if the runtime Java version is at least 21
*/
final class JavaVersionChecker {

private JavaVersionChecker() {}

/**
* The main entry point. The exit code is 0 if the Java version is at least 11, otherwise the exit code is 1.
* The main entry point. The exit code is 0 if the Java version is at least 21, otherwise the exit code is 1.
*
* @param args the args to the program which are rejected if not empty
*/
Expand All @@ -53,10 +53,10 @@ public static void main(final String[] args) {
if (args.length != 0) {
throw new IllegalArgumentException("expected zero arguments but was " + Arrays.toString(args));
}
if (Runtime.version().compareTo(Version.parse("11")) < 0) {
if (Runtime.version().compareTo(Version.parse("21")) < 0) {
final String message = String.format(
Locale.ROOT,
"OpenSearch requires Java 11; your Java version from [%s] does not meet this requirement",
"OpenSearch requires Java 21; your Java version from [%s] does not meet this requirement",
System.getProperty("java.home")
);
errPrintln(message);
Expand Down
Loading