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
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
Related
I am currently with installing and integrating a couple of software on Linux, and I'm very new to Linux. One of the software refuses to run and instructs me to properly set $JAVA_HOME. But I have set $JAVA_HOME! However, when I check the $JAVA_HOME and java -version tests to see if I have done it correctly, it only produces the correct answer when I'm logged in as opc. The permissions of the software I am trying to install is oracle. Do I need to set $JAVA_HOME again when I'm logged in as oracle? And why?
[opc#mydir ~]$ $JAVA_HOME
-bash: /u01/jdk-11.0.3/: Is a directory
[opc#mydir ~]$ java -version
java version "11.0.3" 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)
[opc#mydir ~]$ sudo su oracle
[oracle#mydir opc]$ $JAVA_HOME
[oracle#mydir opc]$ java -version
bash: java: command not found
Environment variables (such as $JAVA_HOME) are set per process. For shells, you'd usually have some initialization script (like .bashrc) that sets all the relevant variables for the current session. You should copy the initialization of $JAVA_HOME you have in the opc user to the oracle user too.
I have a machine with CentOS7. The default Java is
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
I want to change this to
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
To do so, I have so far followed the steps as given below.
Download jdk-8u212-linux-x64.tar.gz file
I could not untar the above using tar -zxvf jdk-8u212-linux64.tar.gzto a specified directory. Hence I used 7-zip and the extracted the JDK1.8.0_212 folder and copied the same to /usr/lib/jvm
Then I made the necessary changes at /etc/profile. There I set the JAVA_HOME as export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_212 and followed by export PATH=$PATH:$JAVA_HOME\bin
However, when I typed update-alternatives --config java I could not see jdk1.8.0_212/bin/java as path. Instead I saw only openjdk options.
My question is: How to set my default Java as Oracle Java as mentioned above. The reason I am asking is I have found that sqljdbc4-x.jar is not compatible with openJDK. I have already raised a query here
A simple approach would be to first remove Open JDK using purge then install Oracle jdk..if u are using apt-get it would automatically set the necessary Java Paths.
Here is what I meant.
yum list java*
sudo yum -y remove java*
java -version
cd
mkdir tmp
cd tmp
curl -u uftp:uftp ftp://192.168.2.115/path/developer/jdk-8u151-linux-x64.tar.gz -o jdk-8u151-linux-x64.tar.gz
tar zxvf jdk-8u151-linux-x64.tar.gz
sudo mv jdk1.8.0_151 /usr/share/
sudo vim /etc/profile
#add
export JAVA_HOME=/usr/share/jdk1.8.0_151
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
source /etc/profile
java -version
which java
cheers.
I am installing SUbversion Edge under CentOS 7.
The first step is
Set the JAVA_HOME environment variable, and point it to your Java 6 JRE
home. For example:
export JAVA_HOME=/usr/java/default
Test the variable:
$ $JAVA_HOME/bin/java -version
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
The problem is that /usr/java forlder not exists.
But /usr/bin/java is existing.
Have I use this folder instead?
So what do I have to do?
You should use correct Java home path in your system. If you installed Java in CentOS via YUM, then correct path should be
export JAVA_HOME=/usr/lib/jvm/jre
You should not use /usr/bin/java as JAVA_HOME, because it is not Java home path, it is symlink to java executable.
I have a appilcation that needs Java 32bit on my Debian 64bit server. Is running fine now with this in the .profile or in the SH file.
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_25/
export LD_LIBRARY_PATH=.:$JAVA_HOME/jre/lib/i386/server:$JAVA_HOME/jre/lib/i386/client:/usr/local/lib
However, when I to start it over screen it simply don't load the Java path and the LD lib path.
Anyone has a idea how to solve this problem?
Please, give me the results the next commands in your console
java -version
and
echo $JAVA_HOME
echo $LD_LIBRARY_PATH
Do you have this in you environments variables?
env | grep JAVA
In my case I have this
user:$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
user:$ echo $JAVA_HOME
/opt/jdk/jdk1.8.0_25
user:$ env | grep JAVA
JAVA_HOME=/opt/jdk/jdk1.8.0_25
Please see these 3 commands and their outcomes in MacOS:
Korays-MacBook-Pro:~ koraytugay$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home
Korays-MacBook-Pro:~ koraytugay$ java -version
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Korays-MacBook-Pro:~ koraytugay$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
Why does the first one return 1.8? What exactly is /libexec/java_home ?
Koray,
As per the Oracle docs...
JAVA_HOME is just an environment variable used to trigger the 'java' found in your PATH to use a different JDK image. Unfortunately, not all 'java' startup scripts obey this env variable. It's also used by many java tool startup scripts to determine what 'java' to run, bypassing the 'java' found in the PATH setting. Setting this variable during a JDK build is a bad idea, don't do it.
I use Eclipse myself, and don't have a JAVA_HOME env variable defined, here is my output running the same commands.
brandon#brandons-mbp ~
$ /usr/libexec/java_home
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
brandon#brandons-mbp ~
$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
brandon#brandons-mbp ~
$ echo $JAVA_HOME
Not sure why you have two different versions but did you try updating your JDK recently? Maybe when you upgraded it failed to launch a script to update your $JAVA_HOME.
Here's the instructions for installing JDK and setting JAVA_HOME on *nix based OSes.
Let me know if that helps I can help you dig deeper if need be.