Starting elasticsearch: which: no java in (/sbin:/usr/sbin:/bin:/usr/bin) Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME


(shashwat) #1

Hi,

I am installing elasticsearch 5.5.1 on Linux 64 bit machine without root access. After installation, When I run following command to start service :
sudo -i service elasticsearch start

I get this error message:
Starting elasticsearch: which: no java in (/sbin:/usr/sbin:/bin:/usr/bin) Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME

When I check my Java configuration :
echo $JAVA_HOME = /home/pps/elk/jdk1.8.0_144/bin/java
echo $PATH = /home/pps/elk/jdk1.8.0_144/bin/java/bin

I have also made changes in /etc/sysconfig/elasticsearch for JAVA_HOME as below:
JAVA_HOME=/home/pps/elk/jdk1.8.0_144/bin/java

BUT still it is not working. Am I missing something.

Thanks,


(Jason Tedor) #2

Yes, strip bin/java from the definition of JAVA_HOME, the startup script appends this.


(shashwat) #3

Thanks for the quick reply. I did this change and also made java re-install as previous one was not behaving correctly due to multiple versions installed on machine.
With both the changes I am able to run it now. Once again thanks.


(system) #4

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