1

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

3

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.

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.

0

For Centos 7 or RHEL 7: I faced this problem while installing pycharm-community-2017.1.4 on RHEL 7.1. Error was:

Unsupported Java Version: Cannot start under Java 1.7.0_75-mockbuild_2015_01_16_09_12-b00: Java 1.8 or later is required

I Found that the required version of java is installed but not detected.then I searched over internet and Used the following to resolve this problem:

# alternatives --config java

output:

Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/java-1.7.0-openjdk1.7.0.75-2.5.4.2.el7_0.x86_64 /jre/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
 + 3           /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.31-2.b13.el7.x86_64/jre/bin/java
   4           /usr/java/jdk1.8.0_91/jre/bin/java

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

Now enter the number of your desired version and press enter key as follows:

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

Check Java version:

# java -version

Output:

java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
New contributor
Anurag Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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