Elasticsearch installation PROBLEM. Could not find java

(Harut Sargsyan) #1


I am trying to install elasticsearch on my Ubuntu 16.04 LTS machine. I am following the instructions provided here

After making these 3 steps:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.deb
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.5.4.deb.sha512
shasum -a 512 -c elasticsearch-6.5.4.deb.sha512

I am trying to execute following command to install the elasticsearch:
sudo dpkg -i elasticsearch-6.5.4.deb


It says that I have no java installed or even have no JAVA_HOME environment variable!
But I have installed a Java 11, and also have a JAVA_HOME set! Please see below:

So why is this happening??? What could be the reason of this STRANGE error???

Please feedback ASAP, as this is too urgent!


(Christian Dahlqvist) #2

Is JAVA_HOME set for the ‘elasticsearch’ user?

(Harut Sargsyan) #3

Not sure that I get your question correctly.

I followed the instructions provided here Section: Download and install Debian package Manually.

JAVA_HOME is set for the user "harut" which you can see in my previous screenshots. So I am trying to install elasticsearch for the same user ("harut") where the java is installed.

(Harut Sargsyan) #4

Any Ideas?
What is going wrong with elasticsearch installation?


Make sure you install java properly and set up the class path correctly.
Observed that you have not set up java properly.

It must show in command promp like

java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)

Once java is set up on your machine,then elasticsearch will works fine

(Harut Sargsyan) #6

Java is set up correctly - see my screenshot in above post:


Any Ideas?

(Leandro Maciel) #7

I think that you need to set the JAVA_HOME variable for the root user since you are using sudo to install the package.

The install script tries to run the java application to install elasticsearch and it could not find java because it is running under root and don't have a JAVA_HOME variable set.

Set the variable for the root user or change to root and export the variable before you run dpkg.

(Harut Sargsyan) #8

Actually, JAVA_HOME exists for my root user also, see below:


So I guess this is not the case of installation problem :frowning:

(Harut Sargsyan) #9

Any ideas?

(David Pilato) #10

Read this and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

(Harut Sargsyan) #11

I guess you read only last reply on this thread... If you would read the whole discussion you might notice that this issue is too Urgent, that there are other people already in this thread and I even don't have 2 - 3 days to wait as my company loses money :slight_smile: I suggest to read this.

It is even strange when you see that there are some people that already replied to this thread with their suggestions that I am greatly appreciated. And that my replies on this thread are not to myself, but to others to inform them that the issue still exists.

I see that you are the moderator, so feel free then to remove this thread at all, as I have no wish to continue to find any support here...

(Christian Dahlqvist) #12

When you install from package, Elasticsearch runs as the ‘elasticsearch’ user by default, so it is for this user Jave must be configured and accessible. Also make sure the user can access and run the installation.

This forum is manned by volunteers, out of which some work for Elastic and some do not. If you do require support with SLA, Elastic does offer that through commercial subscriptions.

(David Pilato) #13

It sounds like it's a fresh new installation as far as I understand this thread.
Could you explain why this is urgent?

I do appreciate a lot as well the support this community is providing. This is great and sane.

I just think that it's useless to ping again 1h later your last answer to get people look again at your message.

Some people are not in your time zone and might be sleeping. Some others are just having good time with friends and family, others are just on holidays...

That's why I'm asking you to be patient. If you need private support with SLA we do sell platinum support and I'll be happy to connect you with the sales team.

(Aralex) #14

Hi/Parev Harut,
this is the exact same problem I had but on Windows 10. This seems to be a quite common issue as Google returns MANY similar search entries, not only on this forum but on many others as well.
I hope the ES team addresses this issue and updates the step-by-step guide.
The issue is caused by 3rd party libraries yet to be updated to e compatible with the latest Java.
Although the official ES page states that the pipeline works with the latest stable Java jdk, that is not true.

These are the steps I took which worked for me:

  1. Installed jdk1.8.0_191
  2. Made a script that creates a user env variable named JAVA_HOME and point it to the installed jdk folder (the top most level). Pay attention, the env variable needs to point at the whole folder, NOT the bin folder or java.exe.
    The next line in my script was calling ES as normal.
  3. I had to do step 2 since I didn't have admin rights on my corporate laptop, and user env variables are checked and set by an admin script, so every time I turned the laptop on the JAVA_HOME user env variable had to be set again. The script automated it.
  4. That'S it! Things have been running smoothly since then.

Good luck.


(Peter Steenbergen) #15

This codes works for me, if you run this as root. You will have Elasticsearch and Kibana running at the end.

echo ">> Installing Elastic GPG Key"
wget -O - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | apt-key add -

echo ">> Adding deb package"
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list

#apt-get install openjdk-8-jre-headless -y

echo ">> Updating apt"
add-apt-repository ppa:webupd8team/java
apt-get update

echo ">> Pre-agreeing to Oracle License"
echo debconf shared/accepted-oracle-license-v1-1 select true | \
  sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | \
  sudo debconf-set-selections
echo ">> Installing Java and Elastic Search"
apt-get -y install oracle-java8-installer elasticsearch kibana

echo ">> Java Installed"
echo ">> Elastic Search Installed"
echo ">> Kibana Installed"

echo ">> Starting Elasticsearch"
systemctl enable elasticsearch
systemctl start elasticsearch
systemctl enable kibana
systemctl start kibana

echo ">> Running on port 9200. Make sure to add a firewall rule if you need external access."

(Harut Sargsyan) #16

Ara jan,

Thanks for your response. Yes, I agree, the problem is on ES side definitely. Actually, I followed the steps written in their official documentation. There is even nothing mentioned (at least I couldn't found) related "elasticsearch" user that should be used while installing ES that is mentioned in one of the comments above written by @Christian_Dahlqvist.

And yes, the first idea I had was related to the latest Java version (jdk 11.0.1) that was installed on my machine and maybe ES has some issues related to it. So I tried to use JDK 1.8, but again the same error happened even for that version...

As a workaround, I deployed the docker image for ES to be able to continue my development process until this issue will be solved :slight_smile:

Anyway, thank you, and thanks to everybody who tried to support me on this.

Thanks and
Happy New Year/ Շնորհավոր նոր տարի,


(system) closed #17

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