Elasticsearch using systemd and different JAVA_HOME path


(Stelios Cardsharing) #1

I have installed elasticserach on debian jessie and although i have successfully got it running on ubuntu 14.04 this time i am having an issue with starting the service.

starting elasticsearch from systemd is complaiing that it
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME

Have tried the following :
1)setting JAVA_HOME as a global enviroment variable
2)setting the custom JAVA_HOME path in /etc/init.d/elasticsearch
3)adding JAVA_HOME icustom path in /etc/defaults/elasticsearch

Looking at /usr/lib/systemd/system/elasticsearch.service
i can see that to start the service the following is called

ExecStart=/usr/share/elasticsearch/bin/elasticsearch
-Des.pidfile=${PID_DIR}/elasticsearch.pid
-Des.default.path.home=${ES_HOME}
-Des.default.path.logs=${LOG_DIR}
-Des.default.path.data=${DATA_DIR}
-Des.default.path.conf=${CONF_DIR}

Is there a ways to specify java_home within elasticsearch.service?


(system) #2