# Logstash can not find JAVA\_HOME

**URL:** <https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224>\
**Category:** Logstash\
**Created:** [May 29, 2019, 5:48am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224 "2019-05-29T05:48:55Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![zenimagine](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zenimagine](https://discuss.elastic.co/u/zenimagine)\
**Post date:** [May 29, 2019, 5:48am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/1 "2019-05-29T05:48:56Z")

</div>

Unable to install Logstash because it can not find JAVA\_HOME

I did not install JAVA because it is included in ELK. Elasticsearch, Kibana and Logstash are on the same server.

Elacticsearh and Kibana works. But how to configure the installation of Logstash ?

I am on Ubuntu 18.04

```
ubuntu@monitoring-example-com:~$ sudo apt install logstash
 
 
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following NEW packages will be installed:
  logstash
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 173 MB of archives.
After this operation, 299 MB of additional disk space will be used.
Get:1 https://artifacts.elastic.co/packages/7.x/apt stable/main amd64 logstash all 1:7.1.0-1 [173 MB]
Fetched 173 MB in 16s (11.0 MB/s)                                                                                                          
Selecting previously unselected package logstash.
(Reading database ... 166387 files and directories currently installed.)
Preparing to unpack .../logstash_1%3a7.1.0-1_all.deb ...
Unpacking logstash (1:7.1.0-1) ...
Setting up logstash (1:7.1.0-1) ...
could not find java; set JAVA_HOME or ensure java is in PATH
chmod: cannot access '/etc/default/logstash': No such file or directory
dpkg: error processing package logstash (--configure):
 installed logstash package post-installation script subprocess returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (1)
```

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 29, 2019, 6:14am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/2 "2019-05-29T06:14:08Z")

</div>

> [@zenimagine](#):
>
> I did not install JAVA because it is included in ELK

It's not though. You do need to install it.

---

<div class="post-metadata">

**Author:** ![zenimagine](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zenimagine](https://discuss.elastic.co/u/zenimagine)\
**Post date:** [May 29, 2019, 6:36am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/3 "2019-05-29T06:36:10Z")

</div>

I did not understand your answer. According to the documentation, JAVA is included in ELK and there is no need to install it

[https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html)

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 29, 2019, 6:37am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/4 "2019-05-29T06:37:42Z")

</div>

That's for Elasticsearch, not for Logstash.  
So you either need to tell Logstash to use the bundled one in Elasticsearch - which I am not sure if we support - or install your own.

---

<div class="post-metadata">

**Author:** ![zenimagine](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zenimagine](https://discuss.elastic.co/u/zenimagine)\
**Post date:** [May 29, 2019, 6:39am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/5 "2019-05-29T06:39:56Z")

</div>

ok. will i have the same problem with filebeat install on another instance?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 29, 2019, 6:40am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/6 "2019-05-29T06:40:20Z")

</div>

Filebeat does not use java.

---

<div class="post-metadata">

**Author:** ![zenimagine](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zenimagine](https://discuss.elastic.co/u/zenimagine)\
**Post date:** [May 29, 2019, 6:41am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/7 "2019-05-29T06:41:47Z")

</div>

Is there an Ubuntu command to locate JAVA integrate with ES?

---

<div class="post-metadata">

**Author:** ![zenimagine](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zenimagine](https://discuss.elastic.co/u/zenimagine)\
**Post date:** [May 29, 2019, 6:46am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/8 "2019-05-29T06:46:55Z")

</div>

I found this but I do not know what I need to change

`/usr/share/elasticsearch/jdk`

ubuntu@monitoring-example-com:/usr/share/elasticsearch/jdk$ ls -l  
total 28  
drwxr-xr-x 2 root root 4096 May 24 21:56 bin  
drwxr-xr-x 5 root root 4096 May 24 21:56 conf  
drwxr-xr-x 3 root root 4096 May 24 21:56 include  
drwxr-xr-x 2 root root 4096 May 24 21:56 jmods  
drwxr-xr-x 72 root root 4096 May 24 21:55 legal  
drwxr-xr-x 5 root root 4096 May 24 21:56 lib  
-rw-r--r-- 1 root root 1190 May 16 02:52 release

---

<div class="post-metadata">

**Author:** ![Gidi\_Kalef](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gidi_kalef/32/43651_2.png) [@Gidi\_Kalef](https://discuss.elastic.co/u/Gidi_Kalef)\
**Post date:** [May 29, 2019, 11:20am UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/9 "2019-05-29T11:20:27Z")

</div>

Please export your JAVA\_HOME  
export JAVA\_HOME={{ path\_of\_java\_home}}

for example:

export JAVA\_HOME=/usr/share/elasticsearch/jdk

---

<div class="post-metadata">

**Author:** ![zenimagine](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zenimagine](https://discuss.elastic.co/u/zenimagine)\
**Post date:** [May 29, 2019, 6:15pm UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/10 "2019-05-29T18:15:22Z")

</div>

It does not work

**ubuntu@monitoring-revolutime-com:/usr/share/elasticsearch/jdk$ ls -l**  
total 28  
drwxr-xr-x 2 root root 4096 May 24 21:56 bin  
drwxr-xr-x 5 root root 4096 May 24 21:56 conf  
drwxr-xr-x 3 root root 4096 May 24 21:56 include  
drwxr-xr-x 2 root root 4096 May 24 21:56 jmods  
drwxr-xr-x 72 root root 4096 May 24 21:55 legal  
drwxr-xr-x 5 root root 4096 May 24 21:56 lib  
-rw-r--r-- 1 root root 1190 May 16 02:52 release

**ubuntu@monitoring-example-com:/usr/share/elasticsearch/jdk$ cd bin**

**ubuntu@monitoring-example-com:/usr/share/elasticsearch/jdk/bin$ ls -l**  
total 520  
-rwxr-xr-x 1 root root 12952 May 16 02:53 jaotc  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jar  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jarsigner  
-rwxr-xr-x 1 root root 8720 May 16 02:53 java  
-rwxr-xr-x 1 root root 8784 May 16 02:53 javac  
-rwxr-xr-x 1 root root 8784 May 16 02:53 javadoc  
-rwxr-xr-x 1 root root 8736 May 16 02:53 javap  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jcmd  
-rwxr-xr-x 1 root root 12904 May 16 02:53 jconsole  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jdb  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jdeprscan  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jdeps  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jfr  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jhsdb  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jimage  
-rwxr-xr-x 1 root root 12880 May 16 02:53 jinfo  
-rwxr-xr-x 1 root root 8784 May 16 02:53 jjs  
-rwxr-xr-x 1 root root 8784 May 16 02:53 jlink  
-rwxr-xr-x 1 root root 12880 May 16 02:53 jmap  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jmod  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jps  
-rwxr-xr-x 1 root root 8792 May 16 02:53 jrunscript  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jshell  
-rwxr-xr-x 1 root root 12880 May 16 02:53 jstack  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jstat  
-rwxr-xr-x 1 root root 8736 May 16 02:53 jstatd  
-rwxr-xr-x 1 root root 8736 May 16 02:53 keytool  
-rwxr-xr-x 1 root root 8736 May 16 02:53 pack200  
-rwxr-xr-x 1 root root 8736 May 16 02:53 rmic  
-rwxr-xr-x 1 root root 8736 May 16 02:53 rmid  
-rwxr-xr-x 1 root root 8744 May 16 02:53 rmiregistry  
-rwxr-xr-x 1 root root 8736 May 16 02:53 serialver  
-rwxr-xr-x 1 root root 117704 May 16 02:53 unpack200

**ubuntu@example-revolutime-com:~$ export JAVA\_HOME=/usr/share/elasticsearch/jdk**

**ubuntu@example-revolutime-com:~$ sudo apt install logstash**  
Reading package lists... Done  
Building dependency tree  
Reading state information... Done  
The following packages will be upgraded:  
logstash  
1 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.  
1 not fully installed or removed.  
Need to get 173 MB of archives.  
After this operation, 142 kB of additional disk space will be used.  
Get:1 [https://artifacts.elastic.co/packages/7.x/apt](https://artifacts.elastic.co/packages/7.x/apt) stable/main amd64 logstash all 1:7.1.1-1 [173 MB]  
Fetched 173 MB in 15s (11.5 MB/s)  
(Reading database ... 182520 files and directories currently installed.)  
Preparing to unpack .../logstash\_1%3a7.1.1-1\_all.deb ...  
Unpacking logstash (1:7.1.1-1) over (1:7.1.0-1) ...  
Setting up logstash (1:7.1.1-1) ...  
could not find java; set JAVA\_HOME or ensure java is in PATH  
chmod: cannot access '/etc/default/logstash': No such file or directory  
dpkg: error processing package logstash (--configure):  
installed logstash package post-installation script subprocess returned error exit status 1  
Errors were encountered while processing:  
logstash  
E: Sub-process /usr/bin/dpkg returned an error code (1)

---

<div class="post-metadata">

**Author:** ![Gidi\_Kalef](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gidi_kalef/32/43651_2.png) [@Gidi\_Kalef](https://discuss.elastic.co/u/Gidi_Kalef)\
**Post date:** [May 29, 2019, 8:28pm UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/11 "2019-05-29T20:28:01Z")

</div>

Can you please create the file:  
etc/default/logstash

And out there java hine env?

And try again?

---

<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:** [June 26, 2019, 8:28pm UTC](https://discuss.elastic.co/t/logstash-can-not-find-java-home/183224/12 "2019-06-26T20:28:06Z")

</div>

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