Hanya Sebagai Pengingat

=================================

Rabu, 04 November 2009

How to update Java on Fedora

By Shahram Javey

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.

Tidak ada komentar: