installed java, but java -version not showing new java
Solution 1
I figured this out. I just appended the new java path to the beginning of my path variable instead of the end and it worked.
export PATH=/usr/local/testing/jdk1.6.0_23/bin:$PATH
That worked. Now i am going to set in my script so it will do automatically.
Solution 2
Try removing /opt/j2sdk/bin
and /usr/local/testing/jdk1.6.0_23/bin
from your PATH
.
When you ran alternatives --config
, it should have changed /usr/bin/java
to point to the 1.6.0 version.
If you add them to PATH
and are using alternatives
, you will have two places to configure things, and it will get confusing.
Related videos on Youtube
prolink007
I am a Computer Engineer. Things listed below are just a few things i am knowledgeable of: C/C++/C#, java, QT, Android, linux, Object Oriented, Assembly, computer architecture, MIPS, msp430, networking, html, php, css, mysql, sqlite, oracle
Updated on September 17, 2022Comments
-
prolink007 over 1 year
I just installed jdk1.6.0. I have tried multiple ways to set the path variable and make java 1.6 my new running version. And nothing is working. Running centos5 virtual machine.
alternatives --config java returns the following:
Selection Command ----------------------------------------------- *+ 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 2 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
java -version returns the following:
java version "1.4.2_19" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04) Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)
echo $PATH returns the following:
/root/bin:/opt/j2sdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/testing/jdk1.6.0_23/bin:/usr/local/testing/jdk1.6.0_23/bin
1.6.0 is installed in the following location: /usr/local/testing/jdk1.6.0_23/bin