Elasticsearch plugin-install don't use the proper Java version

I try to install the OpenNlp plugin on my local machine with the command
bin/elasticsearch-plugin install https://github.com/spinscale/elasticsearch-ingest-opennlp/releases/download/

But the commande send the following exception
Exception in thread "main" java.lang.IllegalStateException: ingest-opennlp requires Java 17:, your system: 11

I don't understand why because :

java --version
java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
javac --version
javac 17.0.1

And my Elasticsearch node java version is :

"jvm" : {
        "pid" : 9360,
        "version" : "17.0.1",
        "vm_name" : "Java HotSpot(TM) 64-Bit Server VM",
        "vm_version" : "17.0.1+12-LTS-39",
        "vm_vendor" : "Oracle Corporation",
        "bundled_jdk" : true,
        "using_bundled_jdk" : false,

I'm on ubuntu 18.04 and installed Elasticsearch with apt.
I don't understand which Java the Elasticsearch-plugin binary use.

Thank you in advance for your help


thanks for reporting this. I fixed the opennlp plugin to be java11 compatible with the next release, as there are no java 17 features being used.

On your issue: My assumption here is, that running bin/elasticsearch-plugin starts a different JVM, than running Elasticsearch as a local service.

Can you try running

source ./bin/elasticsearch-env
echo $JAVA


Thank you very much for your quick response.
unfortunatly the command

source ./bin/elasticsearch-env

Just crash my bash

send and empty line.
How could I force the java version of plugin install ?

Ok that was quite easy but sorry i'm not a java dev

For other people who have a issue like this :

ES_JAVA_HOME="/usr/lib/jvm/java-17-oracle" ./elasticsearch-plugin install https://github.com/spinscale/elasticsearch-ingest-opennlp/releases/download/

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.