Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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"
share|improve this question

migrated from stackoverflow.com May 29 '13 at 0:48

This question came from our site for professional and enthusiast programmers.

1  
serverfault.com/questions/399332/… –  Aubin May 28 '13 at 19:01
    
This is the right solution. Edit the environment is not enough. –  Freya Ren May 28 '13 at 19:19
add comment

1 Answer

up vote 4 down vote accepted

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.

share|improve this answer
1  
No, definitely NO! See serverfault.com/questions/399332/… –  Aubin May 28 '13 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 '13 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 '13 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 '13 at 19:18
add comment

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.