I downloaded and installed elasticsearch

**On Linux Mint. I extracted the archive tar.gz and cd into elasticsearch dir and ran ./bin/elasticsearch, **

The error message was: could not find java in the bundled jdk dir.

I have Open JDK already installed on my system.

Hi Paul
If you have already installed java. you have to set JAVA_HOME variable.
You can use below command to do that

export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which java)))))
export PATH=$PATH:$JAVA_HOME/bin

To confirm that you've done it correctly run this command:

echo $JAVA_HOME

The output off command should be something like:

/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.el7_9.x86_64/jre

Which file should I edit ? there are multiple files that have been recommended.

First of all test these commands and run elasticsearch again:

export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which java)))))
export PATH=$PATH:$JAVA_HOME/bin

If everything's ok you can create the file and add commands to that in this directory:

 /etc/profile.d/java.sh

and finally, make source that:

source  /etc/profile.d/java.sh

Even if I have Java on the PATH variable, do I have to do it again ?

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