1.Download the Java package from:
http://java.sun.com/javase/downloads/index.jsp. Always use the latest update.
Select: Java SE Runtime Environment (JRE) 6 Update 17 (the JDK is for developers)
On the next page, for Platform select "Linux" for 32-bit users, and "Linux x64" for 64-bit users.
For Language select "Multi-language". Also accept the license agreement, and hit "Continue".
On the next page, select the RPM option:
Java SE Runtime Environment 6u17
jre-6u17-linux-i586-rpm.bin (32-bit users)
jre-6u17-linux-x64-rpm.bin (64-bit users)
2.To install:
[mirandam@charon Download]$ sudo sh jre-6u17-linux-i586-rpm.bin
-OR-
[mirandam@charon Download]$ sudo sh jre-6u17-linux-x64-rpm.bin
You will need to hit 'space' till it reaches the end, then type 'yes'. You should see the RPM installing. If it does not install, manually install it via sudo rpm -ivh.
When running the java command, Fedora will default to using OpenJDK. In order to use Sun Java, use the alternatives command.
To setup the Java runtime, perform the following (applies to both 32-bit and 64-bit users):
[mirandam@charon Download]$ sudo /usr/sbin/alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000
3.Setup the Mozilla/Firefox browser plugin.
For 32-bit users:
[mirandam@charon Download]$ sudo /usr/sbin/alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so /
libjavaplugin.so /usr/java/default/plugin/i386/ns7/libjavaplugin_oji.so 20000
For 64-bit users:
[mirandam@charon Download]$ sudo /usr/sbin/alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so /
libjavaplugin.so.x86_64 /usr/java/default/lib/amd64/libnpjp2.so 20000
You may need to restart Firefox to see the plugin take effect.
4.Note: If you wish to switch back to OpenJDK you can run the following commands one by one to switch between the OpenJDK and Sun Java:
[mirandam@charon ~]$ sudo /usr/sbin/alternatives --config java
[mirandam@charon ~]$ sudo /usr/sbin/alternatives --config libjavaplugin.so
(or for 64-bit)
[mirandam@charon ~]$ sudo /usr/sbin/alternatives --config libjavaplugin.so.x86_64
To Update: If you wish update the JRE package, simply download the newest RPM package and install it as above. You will NOT need to reset alternatives, as those settings should remain intact.
another method:
1.find IcedTeaPlugin.so in the directoyr /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/;
2.install sun jdk on /usr/local/java/jdk1.6.0_16/;
3.mv /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/IcedTeaPlugin.so /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/IcedTeaPlugin.so_bak
4.ln -s /usr/local/java/jdk1.6.0_16/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/IcedTeaPlugin.so
5.sudo firefox, and input about:plugins in address bar, you will find firefox now support sun jdk;