How to update Java on Fedora


In Fedora, you’ll need to follow long chain of symbolic links to get to the java command. Running the command which java, yields

/usr/bin/java which is a link to
/etc/alternatives/java which links to
/usr/lib/jvm/jre-1.4.2-gcj/bin/java which links to
/usr/bin/gij.

The default java in Fedora is the GNU java. Changing java to be the latest version of SUN Java is simple. Just follow the instructions below:

  1. Download the latest JDK for linux (jdk-6u1-linux-i586-rpm.bin).
  2. sh jdk-6u1-linux-i586-rpm.bin This will create the RPM file.
  3. su — become root
  4. rpm -Uvh jdk-6u1-linux-i586.rpm This will install the JDK in /usr/java/ folder.
  5. create the file /etc/profile.d/java.sh with the following content:

    export JAVA_HOME=/usr/java/jdk1.6.0_01
    export JAVA_PATH=$JAVA_HOME
    export PATH=$JAVA_HOME/bin:$PATH

    When a user logs in, environment variables are defined & accumulated in the following order:

    1. /etc/profile (for all users)
    2. All the files in the /etc/profile.d directory
    3. Then ~/.bash_profile
    4. Finally ~/.bashrc
  6. chmod +x /etc/profile.d/java.sh
  7. log out and log back in. Now when you run the command java -version, you’ll see that you’re using the latest version of SUN Java — 1.6.0_01.

3 Responses to “How to update Java on Fedora”

  1. Santosh B R Says:

    Thanks for the nice HowTo. It really helped me in updating java in my linux machine. The steps are explained in a clear and simple manner.

  2. Nambi Says:

    Great tutorial for Fedora – it really works.
    Thanks!

  3. Bryant Says:

    Thanks for the comprehensive tutorial.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.