Skip to content

[9.4] (backport #19010) require java 21, since jruby 10 requires it#19015

Merged
yaauie merged 1 commit into
9.4from
mergify/bp/9.4/pr-19010
Apr 16, 2026
Merged

[9.4] (backport #19010) require java 21, since jruby 10 requires it#19015
yaauie merged 1 commit into
9.4from
mergify/bp/9.4/pr-19010

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify Bot commented Apr 16, 2026

Release notes

Sets the minimum version of Java to 21.

What does this PR do?

Updates the check in the JVMOptionsParser to provide helpful output when logstash is invoked with a JVM that does not meet JRuby 10's minimum requirement.

Why is it important/What is the impact to the user?

Without this, invoking Logstash on JVM 17 produces an obscure and unhelpful error message:

╭─{ rye@perhaps:~/src/elastic/logstash@main }
╰─● (jenv shell 17; bin/logstash -e '')
Using system java: /Users/rye/.jenv/shims/java
Error: Unable to initialize main class org.logstash.Logstash
Caused by: java.lang.UnsupportedClassVersionError: org/jruby/exceptions/RaiseException has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
[error: 1] 

With it, the message is helpful and clear:

╭─{ rye@perhaps:~/src/elastic/logstash@main (require-java-21 ✘) }
╰─● (jenv shell 17; bin/logstash -e '')
Using system java: /Users/rye/.jenv/shims/java
The minimum required Java version is 21; your Java version from [/opt/homebrew/Cellar/openjdk@17/17.0.15/libexec/openjdk.jdk/Contents/Home] is [17] and does not meet this requirement
[error: 1]

Checklist

  • My code follows the style guidelines of this project
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files (and/or docker env variables)
  • [ ] I have added tests that prove my fix is effective or that my feature works

How to test this PR locally

  • Build Logstash normally with Java 21
  • Launch Logstash with Java 17
    • jenv: (jenv shell 17; bin/logstash -e "")
    • LS_JAVA_HOME LS_JAVA_HOME=/path/to/java17 bin/logstash -e ""

Related issues

Use cases


This is an automatic backport of pull request #19010 done by [Mergify](https://mergify.com).

@mergify mergify Bot added the backport label Apr 16, 2026
@mergify mergify Bot assigned yaauie Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • run exhaustive tests : Run the exhaustive tests Buildkite pipeline.

@elasticmachine
Copy link
Copy Markdown

💚 Build Succeeded

cc @yaauie

Copy link
Copy Markdown
Member

@yaauie yaauie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-backport clean and green 💚✅

@yaauie yaauie merged commit 5b7e712 into 9.4 Apr 16, 2026
13 checks passed
@yaauie yaauie deleted the mergify/bp/9.4/pr-19010 branch April 16, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants