JAVA is not on the way, although JAVA_HOME is installed

I set all the requirement variables in / etc / profile, but when I run elasticsearch it still does not find Java. How can I set an environment variable. What is my / etc / profile

PATH=$PATH:$HOME/bin APPLICATIONS=$HOME/Applications JAVA_HOME=$APPLICATIONS/jdk1.7.0_79 PATH=$JAVA_HOME/bin:$PATH export APPLICATIONS export JAVA_HOME export PATH 

Command output

 [ root@87500e63467f Applications]# echo $PATH /root/Applications/jdk1.7.0_79/bin:/root/Applications/jdk1.7.0_79/bin:/root/Applications/jdk1.7.0_79/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/bin:/root/bin [ root@87500e63467f Applications]# echo $JAVA_HOME /root/Applications/jdk1.7.0_79 [ root@87500e63467f Applications]# java -version java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode) error: "Read-only file system" setting key "vm.max_map_count" 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 [FAILED] 

in error, he says that "Running elasticsearch: which: no java in (/ sbin: / usr / sbin: / bin: / usr / bin)", it means that really java is not in this path, but how it goes when I repeat $ PATH, does it show that java is on the way?

+13
java linux environment-variables elasticsearch
source share
11 answers

In particular, for OpenBSD6.0 add

 export JAVA_HOME=/usr/local/jdk-1.8.0/ 

to your .profile .

This particular version of jdk and perhaps the main path may be changed in subsequent and previous versions of OpenBSD, you have been warned.

+4
source share

After reading the documents from ElasticSearch, I found that if you are running Ubuntu or Debian, the package only comes with OpenJDK due to licensing issues. To fix this Java path issue, I installed the following after installing ElasticSearch (as indicated in the documentation):

 sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer java -version 

Then, when running sudo service elasticsearch start everything worked, and I no longer had problems with Java paths.

+31
source share

run the command

 java -XshowSettings 

find the java.home = /usr/java/jdk1.8.0_91/jre

export java_home to your bash profile

 export JAVA_HOME=/usr/java/jdk1.8.0_91/jre 

or in /etc/profile for extension for all users

+9
source share

To get this β€” albeit not very pleasant β€” you could set a symbolic link to your java in / usr / bin (which is listed in the elasticsearch search results):

 ln -s /root/Applications/jdk1.7.0_79/bin/java /usr/bin/java 
+1
source share

I noticed one file in the output called / etc / sysconfig / elasticsearch

this can do the trick, so I defined JAVA_HOME in this file and it works.

more u can get from here

+1
source share

Make sure the path you provided for JAVA_HOME is correct.

And why not keep it simple:

 export PATH=$PATH:/path/to/jdk 

try installing Java home on / jdk 1.7.0_79 / bin and see if that helps.

0
source share

Just add the path below to bashrc and the profile file to the /etc/ directory.

export JAVA_HOME = / path / to / java / jdk

export PATH = $ JAVA_HOME / bin: $ PATH

0
source share

The same problem was found when installing Elasticsearch 5 on a debian machine. The way I installed Java 9:

 su - echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 apt-get update apt-get install oracle-java9-installer 
0
source share

I don’t know if this is your specific situation, but when working with ElasticSearch / Kibana / Logstash (ELK stack), the documents did not work for me on Ubuntu 16.04. Putting the content from this post along with several others, my solution was:

  sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer # checking my work given 9 won't work with OSSEC you can use # java -version sudo usermod -a -G ossec logstash sudo apt-get install logstash sudo systemctl daemon-reload sudo systemctl enable logstash.service sudo systemctl start logstash.service 

The end result for me on ubuntu 16.04 was

 sudo java -version java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode) 

If you are working with wazuh, it is important to add PPA for your specific versions. Hope this helps.

0
source share

you need to set JAVA_HOME to / etc / default / asticsearch like
cat/etc/default/elasticsearch JAVA_HOME=/var/local/jdk1.8.0_151

next start /etc/init.d/elasticsearch start
ES is working. my ubuntu18.04 OS.

0
source share

If you use "not installed" Java, check if your user "asticsearch" has access to the JAVA_HOME directory you specify and all the parent directories. That was my problem ..

0
source share

All Articles