Unable to find java executable. Check JAVA_HOME … while starting Cassandra

Issue

Running Cassandra

$ apache-cassandra-3.11.1/bin/cassandra -f -R
Unable to find java executable. Check JAVA_HOME and PATH environment variables.

Java Settings are

java -version
openjdk version "1.8.0_121"
OpenJDK Runtime Environment (Zulu 8.20.0.5-linux64) (build 1.8.0_121-b15)
OpenJDK 64-Bit Server VM (Zulu 8.20.0.5-linux64) (build 25.121-b15, mixed mode)

whereis java
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /data/ytbigdata/anaconda3/bin/java

which java
~/anaconda3/bin/java

~/.bash_profile setting
export JAVA_HOME=/data/ytbigdata/anaconda3/bin/java
export PATH=$JAVA_HOME/bin:$PATH

Solution

The Cassandra documentation says “On the Cassandra nodes where the agents are installed, create the file /etc/default/datastax-agent and set the environment variables for JAVA_HOME and any other custom environment variables that the agent might need.” https://docs.datastax.com/en/opscenter/6.1/opsc/install/opscCustomVariables_t.html

Answered By – NSchorr

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published