Http://www.icycandy.com/blog/install-sun-jdk-6-on-fedora-14
The default Java version installed on Fedora 14 is OpenJDK. In most cases, OpenJDK is enough, but in some cases Sun JDK is necessary.
1. Download
The latest version is JDK 6 Update 22, http://www.oracle.com/technetwork/java/javase/downloads/index.html, select jdk-6u22-linux-i586-rpm.bin on the download page.
2. Installation
# Switch to root user su # Install JDKsh/some/path/jdk-6u22-linux-i586-rpm.bin # install java, javac and so on ## java ## alternatives -- install/usr/bin/java/usr/java/jdk1.6.0 _ 22/jre/bin/java 20000 # javaws (32-bit only) # alternatives -- install/usr/bin/javaws/usr/java/jdk1.6.0 _ 22/jre/bin/javaws 20000 # Firefox browser plug-in 32-bit alternatives -- install/usr/ lib/mozilla/plugins/libjavaplugin. so libjavaplugin. so/usr/java/jdk1.6.0 _ 22/jre/lib/i386/libnpjp2.so 20000 # Firefox browser plug-in 64-bit alternatives -- install/usr/lib64/mozilla/plugins/libjavaplugin. so libjavaplugin. so. x86_64/usr/java/jdk1.6.0 _ 22/jre/lib/amd64/libnpjp2.so 20000 # install javacalternatives -- install/usr/bin/javac/usr/java/jdk1.6.0 _ 22/ bin/javac 20000 # Switch the default Java # Run the following command, select the just-installed Sun JDKalternatives -- config java # Check the current Java version to see if the switch is successful.
3. Set Environment Variables
If you only use Eclipse or NetBeans, you do not need to set environment variables because it will automatically detect the java path in the system. However, if some software cannot automatically detect the path, you need to set environment variables, such as Tomcat.
# If you want the setting to be valid for all users, edit the file/etc/profilevim/etc/profile # or edit the file if you want the setting to be valid only for the current user ~ /. Bash_profilevim ~ /. Bash_profile
Add the following content at the end of the edited File
export JAVA_HOME="/usr/java/jdk1.6.0_22"export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:/lib.dt.jarexport PATH=$JAVA_HOME/bin:$PATH
Save the file after editing, and enter the following command to make the settings take effect.
Source/etc/profile # or source ~ /. Bash_profile