Reputation: 7021
I want update the java version in a CentOS machine,
Actually when I do java -version it gives me :
$java -version
java version "1.7.0_79"
OpenJDK Runtime Environment (rhel-2.5.5.3.el6_6-x86_64 u79-b14)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
I'm using the alternatives to configure which java interpreter should be used :
sudo alternatives --config java
it gives me :
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
+ 3 /usr/lib/jvm/jdk1.8.0_91/bin/java
Enter to keep the current selection[+], or type selection number:
and I selected number 3 (which is the jdk1.8.0_91)
however when I redo java -version it still the openJDK 1.7 selected !!!
$java -version
java version "1.7.0_79"
OpenJDK Runtime Environment (rhel-2.5.5.3.el6_6-x86_64 u79-b14)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
Upvotes: 0
Views: 1184
Reputation: 306
Run these command to check your configuration:
$ which java
and the result should be /bin/java
or /usr/bin/java
. Otherwise, check your environment profile (/etc/bashrc, /etc/profile, ~/.bash_profile, ~/.bashrc, etc.) and remove similar export JAVA_HOME="/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79.x86_64/jre"
declared.$ ls -al /bin/java
or $ ls -al /usr/bin/java
should be point to /etc/alternatives/java
or alternatives will be ineffective.Upvotes: 1