Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 314
spadel Avatar asked Sep 25 '20 18:09

spadel


People also ask

How do I set Java path in Elasticsearch?

According to the Elasticsearch configuration docs, you can edit /etc/default/elasticsearch and set JAVA_HOME there for Elasticsearch.

Is Java required for Elasticsearch?

Note: Elasticsearch requires at least Java version 7, but for Elasticsearch version 1.7. 1 it is recommended that you use Oracle JDK version 1.8. 0_25 or higher on the operating system that deploys the Elasticsearch server. Therefore, set JAVA_HOME accordingly.


1 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>
like image 110
ESCoder Avatar answered Oct 27 '22 07:10

ESCoder