JDK in Fedora 13 (Updated for the JDK 6.0 64 bits)

Once we have the installer in our local repository (as root):

chmod a+x  jdk-6u21-linux-x64-rpm.bin

./jdk-6u21-linux-x64-rpm.bin


Once we have the installer in our local repository (as root):

chmod a+x  jdk-6u21-linux-x64-rpm.bin

./jdk-6u21-linux-x64-rpm.bin

Next, we must add these two lines to the file: /etc/profile

JAVA_HOME=/usr/java/jdk1.6.0_21

pathmunge $JAVA_HOME/jre/bin after

At the end of the line that starts with export, we need to add this our JAVA_HOME variable, so the line should be like this:

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME

Then, we need to execute the next statements. Hint: Copy all the lines like if were just one.

export JAVA_HOME=/usr/java/jdk1.6.0_21

export JAVA_ALTERNATIVE_PRIORITY=16021

/usr/sbin/update-alternatives –install /usr/bin/java java $JAVA_HOME/bin/java $JAVA_ALTERNATIVE_PRIORITY

/usr/sbin/update-alternatives –install /usr/bin/javadoc javadoc $JAVA_HOME/bin/javadoc $JAVA_ALTERNATIVE_PRIORITY

/usr/sbin/update-alternatives –install /usr/bin/appletviewer appletviewer $JAVA_HOME/bin/appletviewer $JAVA_ALTERNATIVE_PRIORITY

/usr/sbin/update-alternatives –install /usr/bin/javah javah $JAVA_HOME/bin/javah $JAVA_ALTERNATIVE_PRIORITY

/usr/sbin/update-alternatives –install /usr/bin/javac javac $JAVA_HOME/bin/javac $JAVA_ALTERNATIVE_PRIORITY

/usr/sbin/update-alternatives –install /usr/bin/jar jar $JAVA_HOME/bin/jar $JAVA_ALTERNATIVE_PRIORITY

Then, we export the alternatives:

/usr/sbin/update-alternatives –auto java

/usr/sbin/update-alternatives –auto javadoc

/usr/sbin/update-alternatives –auto appletviewer

/usr/sbin/update-alternatives –auto javah

/usr/sbin/update-alternatives –auto javac

/usr/sbin/update-alternatives –auto jar

To confirm that our installation is successfull:

java -version

Should give us an ouptput like this:

[root@yourMachine]# java -version

java version “1.6.0_21”

Java(TM) SE Runtime Environment (build 1.6.0_21-b02)

Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

That’s it. Enjoy.

Credits