0

When I'm trying to install elasticsearch (Ubuntu 16.04) I get the error message:

elasticsearch[15885]:  * no JDK found - please set JAVA_HOME

But I have only one Java and I think JAVA_HOME is set properly...

$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
0

This usually means when elasticsearch is starting up it cannot find the JAVA_HOME variable. You need to make sure JAVA_HOME is globally set. If there is a init.d or elasticsearch startup file put it there. Also you can add it in /etc/default/elastic or create a profile for elasticsearch in /etc/profile.d/elasticsearch.

So to recap, first debug and understand where the problem lies: 1) check how elasticsearch is starting up; 2) check the init/start up file and 3) Then put the JAVA_HOME in the appropriate place.

  • That's the point! Thank you very much! Problem was I'm need to use an old elasticsearch version (0.9) and my java 8 was not in the profile.d script. The solution was add "/usr/lib/jvm/java-8-openjdk-amd64" to JDK_DIRS variable in /etc/profile.d/elasticsearch. – Max Jan 19 '18 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.