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:


The output off command should be something like:


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:


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.