I have installed JAVA 1.7_80 in my centOS machine, but when I check the Java version it shows 1.7_09.
I ran the ./java -version in the installation directory which correctly shows 1.7_80, but the global java -version is 1.7_09.
Please refer the link for image - https://scontent.xx.fbcdn.net/hphotos-xft1/v/t1.0-9/11667333_914348581933741_3461411661734554342_n.jpg?oh=e8d3037e2f6492757b0f786bd0ae8f77&oe=56318F12
Does someone know what could be the cause or how to fix this?
There's default OpenJDK in CentOS,
OPTION A
You have to install JDK with alternatives.
# cd /opt/jdk1.8.0_101/
# alternatives --install /usr/bin/java java /opt/jdk1.8.0_101/bin/java 2
# alternatives --config java
THE OUTPUT ==>
There are 2 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.101-3.b13.el7_2.x86_64/jre/bin/java
+ 2 /opt/jdk1.8.0_101/bin/java
Enter to keep the current selection[+], or type selection number:
Select the version you want from this list.
OR : OPTION B
#ls -l /usr/bin/java
OUTPUT : . 1 root root 22 සැප් 9 02:09 /usr/bin/java -> /etc/alternatives/java
then # ls -l /etc/alternatives/java
OUTPUT : . 1 root root 26 සැප් 9 02:09 /etc/alternatives/java -> /opt/jdk1.8.0_101/bin/java
#unlink /etc/alternatives/java
#ln -s <new location> /etc/alternatives/java
(ln -s <original file> <link to file> )
But I prefer the option A.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With