Java version issue in linux server

1.3k views Asked by At

How to change java version to jdk1.7.0_80?

java -version java version "1.6.0_41" $JAVA_HOME

$JAVA_HOME: -bash: /usr/java/jdk1.7.0_80: is a directory

I have to update jdk version to 1.7.0_80 and i installed as well,but when i enter java -version,i am getting old version only

3

There are 3 answers

0
Asanka Anthony On BEST ANSWER

(1)Use following command to detect installed java version

sudo update-alternatives --config java

enter image description here

(2)Select selection number & Enter

(3)Re-Check java version with

java -version
0
Yugerten On

First remove (puge) all installed JDK or JRE on your system

  sudo apt-get purge openjdk-\*    //(for exemple to remove open jdk on ubuntu)

For other steps you can follow steps in this link

0
Simon On

In CentOs: 1. vim /etc/profile , then edit '$JAVA_HOME'. 2. source /etc/profile, make the configuration take effect. 3. java -version, validate version.

Linux-like systems are similar. (If it does'n worked. Reboot.)