How to set the Java version

6,764

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:
6,764

Related videos on Youtube

Freya Ren
Author by

Freya Ren

Updated on September 18, 2022

Comments

  • Freya Ren
    Freya Ren over 1 year

    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"
    
  • Aubin
    Aubin almost 11 years
    No, definitely NO! See serverfault.com/questions/399332/…
  • Kai
    Kai almost 11 years
    I think I already set the path to .bashrc file, I don't know why it doesn't work.
  • Kai
    Kai almost 11 years
    @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?
  • Kai
    Kai almost 11 years
    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!