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
Answer
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.
Attribution
Source : Link , Question Author : MAL , Answer Author : Tux_DEV_NULL