I have this package of java jdk-7u3-linux-x64.rpm. So I have been doing this normally yum install jdk-7u3-linux-x64.rpm. Then immediately I will do this alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000Next step is this alternatives --config java and pick the latest one. Suddenly this particular machine I am having issue when I run this 2 commands it shows me different version of java and javac causing my programme can't be compiled. Below is all the javaalternatives --config javaThere are 4 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/jre-1.5.0-gcj/bin/java + 4           /usr/java/latest/jre/bin/javaEnter to keep the current selection[+], or type selection number:Java version is as belowjava -versionjava version 1.7.0_03Java(TM) SE Runtime Environment (build 1.7.0_03-b04)Java HotSpot(TM) 64-Bit Server VM (build 22.1-b02, mixed mode)But my javac -version isjavac -versionjavac 1.7.0_19I am very surprised -- where does the 1.7.0_19 come from, because my installation version is just 1.7.0_03? Any idea how to resolve this?
Java installation having issues on Centos java and javac showing different version
centos;java
The alternatives system doesn't always work correctly with third party packages like the Java packages you're installing. You need to either use the CentOS packaged java or create the symlinks yourself without using the alternatives system/command to ensure all links are correct.