Elasticsearch: could not find java in bundled jdk at .../jdk/bin/java

Viewed 15877

When I try to run .bin/elasticsearch, I get the following error:

could not find java in bundled jdk at /home/ubuntu/Elastic Search/elasticsearch-7.8.0/jdk/bin/java

I have absolutely no idea what's going on. I know this topic has been created before, but I haven't found a way to fix. For java -version I get:

openjdk version "1.8.0_265"
OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~20.04-b01)
OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)

Can anyone help me please? Thank you!

2 Answers

The most probable reason for the above error is that JAVA_HOME is not set

  1. To display JAVA_HOME variable path, run this command echo $JAVA_HOME

If nothing appears then follow the below steps:

  1. To see all the java versions installed in Ubuntu, use this command:

sudo update-alternatives --config java

  1. Set your java path using this. - export JAVA_HOME=<YOUR-JAVA-PATH>

I had the similar problem on linux, when I was running elasticsearch using

sh elasticsearch

I got the error

Elasticsearch: could not find java in bundled jdk at .../jdk/bin/java

Then I referred to the official document and set ES_JAVA_HOME environment variable.

After running elasticsearch again, I got the following message and it ran successfully

ignoring JAVA_HOME=/project/jdkForElasticSearch/; using ES_JAVA_HOME 

Note: After setting environment variable, restart your terminal to reflect the updated value in it.

Related