I have installed a new JRE on my RedHat linux system.
lsb_release -i -r
Distributor ID: CentOS
Release: 6.5
I have updated the symbolic links pointing to the desired Java installation:
ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 21 Jul 21 16:27 /usr/bin/java -> /usr/java/jre1.8.0_51
ls -l /usr/java/latest
lrwxrwxrwx. 1 root root 21 Jul 21 15:34 /usr/java/latest -> /usr/java/jre1.8.0_51
ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 20 Jul 21 17:42 /etc/alternatives/java -> /usr/java/glassfish4
But, now when I run:
java -version
-bash: java: command not found
Environment variables:
env
...
JAVA_HOME=/usr/java/latest
...
So I added the following line to .bashrc:
export PATH="$PATH:$JAVA_HOME"
But still get:
java -version
-bash: java: command not found
Resolved - correct line in bashrc:
export PATH=$PATH:/usr/java/jre1.8.0_51/bin/
I don't know why, but using the environment variable pointing to symbolic link export PATH="$PATH:$JAVA_HOME"
does not work, even though it's correctly resolving:
ls -l /usr/java/latest
lrwxrwxrwx. 1 root root 21 Jul 21 15:34 /usr/java/latest -> /usr/java/jre1.8.0_51
I would really like to understand why?
-bash: java: command not found
after logging out/in againjava -> /usr/bin/java
that was part of the installation (I did not create it). I don't know the answer to your question:Is this applicable on your RHEL system? (/usr/sbin/alternatives --config java)