1

I'm using fedora, and I manually installed java in /usr/java/jdk1.6.0_45/jre, using command "rpm". While there is a default java version in /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java.

If I type "java -version" it shows 1.7.0. And as I installed Java using rpm, update-alternatives --config java still shows only 1.7.0 version.

How could I change the system version to 1.6.0?

I also installed and configured maven, if I typed "mvn --version" it shows correctly:

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 08:51:28-0500)
Maven home: /usr/local/apache-maven-3.0.5
Java version: 1.6.0_45, vendor: Sun Microsystems Inc.
Java home: /usr/java/jdk1.6.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.3.4-5.fc17.x86_64", arch: "amd64", family: "unix"
2

1 Answer 1

5

Set your $JAVA_HOME to point to /usr/java/jdk1.6.0_45 and add /usr/java/jdk1.6.0_45/bin to your $PATH variable.

4
  • 1
    No, definitely NO! See serverfault.com/questions/399332/…
    – Aubin
    May 28, 2013 at 19:01
  • I think I already set the path to .bashrc file, I don't know why it doesn't work.
    – Freya Ren
    May 28, 2013 at 19:02
  • @Aubin Hi, I tried the "alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_45/jre 10". Though now I could have two choices, when I change my version and type "java -version", it shows "bash: /usr/bin/java: Is a directory". I typed "which java" and it gives "/usr/bin/java". So do you know where goes wrong?
    – Freya Ren
    May 28, 2013 at 19:10
  • Hi, problem solved, I made a silly mistake to use the wrong java path. It should be /usr/java/jdk1.6.0_45/bin/java. It works!
    – Freya Ren
    May 28, 2013 at 19:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .