Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.