# Java path is not set for Elastic Search

**URL:** <https://discuss.elastic.co/t/java-path-is-not-set-for-elastic-search/127090>\
**Category:** Elasticsearch\
**Created:** [April 6, 2018, 12:12pm UTC](https://discuss.elastic.co/t/java-path-is-not-set-for-elastic-search/127090 "2018-04-06T12:12:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeni](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jeni](https://discuss.elastic.co/u/Jeni)\
**Post date:** [April 6, 2018, 12:12pm UTC](https://discuss.elastic.co/t/java-path-is-not-set-for-elastic-search/127090/1 "2018-04-06T12:12:28Z")

</div>

Hi All  
Lets start the Discussion on this Topic and i am Ubuntu 16.04 and i am downloaded and installed the version **6.2.3** using **_sudo dpkg -i elasticsearch-6.2.3.deb_** and the set up is done properly but it has some problem while checking the status i have mentioned the details below please knindly help me to solve this issue

➜ ~ echo $JAVA\_HOME  
/data/jdk1.8.0\_144  
➜ ~ service elasticsearch restart  
➜ ~ service elasticsearch status  
● elasticsearch.service - Elasticsearch  
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)  
Active: failed (Result: exit-code) since Fri 2018-04-06 16:27:00 IST; 7s ago  
Docs: [http://www.elastic.co](http://www.elastic.co)  
Process: 26057 ExecStart=/usr/share/elasticsearch/bin/elasticsearch **-p ${PID\_DIR}** /elasticsearch.pid --quiet (code=exited,  
Main PID: 26057 (code=exited, status=1/FAILURE)

Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: Stopped Elasticsearch.  
Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: Started Elasticsearch.  
Apr 06 16:27:00 netops-Latitude-5580 elasticsearch[26057]: **_could not find java; set JAVA\_HOME or ensure java is in PATH_**  
Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE  
Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: elasticsearch.service: Unit entered failed state.  
Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: elasticsearch.service: Failed with result 'exit-code'.

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [April 6, 2018, 12:53pm UTC](https://discuss.elastic.co/t/java-path-is-not-set-for-elastic-search/127090/2 "2018-04-06T12:53:41Z")

</div>

Hi @Jeni,

the Elasticsearch service from the Debian package runs as user "elasticsearch". The `JAVA_HOME` variable that you have shown is only set for the current user (which - I assume - is not "elasticsearch").

According to the [Elasticsearch configuration docs](https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html#deb-configuring), you can edit `/etc/default/elasticsearch` and set `JAVA_HOME` there for Elasticsearch. Can you please do this and try to start Elasticsearch again via systemd?

Daniel

---

<div class="post-metadata">

**Author:** ![Jeni](https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/32.png) [@Jeni](https://discuss.elastic.co/u/Jeni)\
**Post date:** [April 9, 2018, 4:58am UTC](https://discuss.elastic.co/t/java-path-is-not-set-for-elastic-search/127090/3 "2018-04-09T04:58:10Z")

</div>

Hi @danielmitterdorfer

Thanks! for your quick replay i have tryed your instruction i really happyafter solving the Java Error and still i am facing this error i don't know what is the problem with my end can you please help me with your sugesstions

● elasticsearch.service - Elasticsearch  
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)  
Drop-In: /etc/systemd/system/elasticsearch.service.d  
└─override.conf  
Active: failed (Result: exit-code) since Mon 2018-04-09 10:16:08 IST; 14s ago  
Docs: [http://www.elastic.co](http://www.elastic.co)  
Process: **6196 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID\_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE**)  
Main PID: 6196 (code=exited, status=1/FAILURE)

Apr 09 10:16:08 netops-Latitude-5580 systemd[1]: Started Elasticsearch.  
Apr 09 10:16:08 netops-Latitude-5580 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE  
Apr 09 10:16:08 netops-Latitude-5580 systemd[1]: elasticsearch.service: Unit entered failed state.  
Apr 09 10:16:08 netops-Latitude-5580 systemd[1]: **elasticsearch.service: Failed with result 'exit-code'.**

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [April 9, 2018, 5:56am UTC](https://discuss.elastic.co/t/java-path-is-not-set-for-elastic-search/127090/4 "2018-04-09T05:56:17Z")

</div>

Hi @Jeni,

can you please check the logs in `/var/log/elasticsearch`? Wild guess: You will see one or more failing bootstrap checks there so you should follow the section [important system configuration](https://www.elastic.co/guide/en/elasticsearch/reference/current/system-config.html) in the docs.

Daniel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 7, 2018, 5:56am UTC](https://discuss.elastic.co/t/java-path-is-not-set-for-elastic-search/127090/5 "2018-05-07T05:56:35Z")

</div>

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