Using Sun (Oracle) Java in Fedora 14

The standard installation of Fedora should install OpenJDK (based off of Sun Java). However if not, it can be installed using YUM:

[Chris@Chris ~]$ sudo yum install java-1.6.0-openjdk 

With OpenJDK installed, Java application and Web applets should automatically work. Unfortunately some applets may not run properly and the OpenJDK might have some limitations. Majority of user should find OpenJDK perfect for everyday use.

Using Sun (Oracle) Java Instead

If you require Sun (Oracle) Java or if OpenJDK does not work properly, you can download Sun (Oracle) Java and use it in Fedora.

Download the Java package from:

Under Java Platform, Standard Edition, Select: Download JRE (the JDK is for Java 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 6u23
jre-6u23-linux-i586-rpm.bin     (32-bit users)

jre-6u23-linux-x64-rpm.bin      (64-bit users) 

To install:

[Chris@Chris Downloads]$ sudo sh jre-6u23-linux-i586-rpm.bin
[Chris@Chris Downloads]$ sudo sh jre-6u23-linux-x64-rpm.bin

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):

[Chris@Chris Downloads]$ sudo /usr/sbin/alternatives --install 
/usr/bin/java java /usr/java/default/bin/java 20000

Setup the Mozilla/Firefox browser plugin.

For 32-bit users:

[Chris@Chris Downloads]$ sudo /usr/sbin/alternatives --install 
/usr/java/default/lib/i386/ 20000

For 64-bit users:

[Chris@Chris Downloads]$ sudo /usr/sbin/alternatives --install 
/usr/java/default/lib/amd64/ 20000

You may need to restart Firefox to see the plugin take effect.

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:

[Chris@Chris ~]$ sudo /usr/sbin/alternatives --config java

[Chris@Chris ~]$ sudo /usr/sbin/alternatives --config
(or for 64-bit)
[Chris@Chris ~]$ sudo /usr/sbin/alternatives --config

SELinux Issue – Currently SELinux is preventing the Java plugin from properly loading. To allow Firefox to load the plugin please run the following:

[Chris@Chris ~]$ sudo chcon -t execmem_exec_t 
(or for 64-bit)
[Chris@Chris ~]$ sudo chcon -t execmem_exec_t 

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.