Tuesday, March 29, 2016

linux java shows older version after upgrade

While working with Linux today I stumbled upon a weird problem, even after upgrading java to 1.8 it was showing 1.7 only.

And when I tried to install it again, it showed me following message.
sudo yum install java-1.8.0-openjdk.x86_64

Package 1:java-1.8.0-openjdk- already installed and latest version

Nothing to do
Following command help me to figure out what's going wrong. 

Following command will show you all the java versions currently installed on your system, it will also show you which one is currently active.  If you need to change just provide the number and that would be activated. 

sudo update-alternatives --config java

There are 2 programs which provide 'java'.

  Selection    Command
 + 1           /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
*  2           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java

Enter to keep the current selection[+], or type selection number: