CSUF LogoCSUF Site Navigation
optics.csufresno.edu

FC5 Multimedia-Based Applications & Setup Java

Department of Electrical and Computer Engineering
Assistant Professor Gregory R. Kriehn
Forums
Wiki
FC5 Java
Starting from Fedora Core 4, users are recommended to not use the Java RPM provided by Sun. The relevant section of the release notes state:



Fedora Core 4 users are advised not to use the Java RPM provided by Sun. It contains Provides that conflict with names used in packages provided as part of Fedora Core 4. Because of this, Sun Java might disappear from an installed system during package upgrade operations. Fedora Core 4 users should use either the RPM from jpackage.org or manually install the Sun Java tarball into /opt. Sun Java 1.5+ is recommended for stability purposes.



This is also true for FC5, as the same issues still affect it. As a result, we will be installing java into /opt. Be sure that SELinux has been configured properly before starting (see the SELinux page).

Installing Java
Open your favorite web browser and go to Sun's download page for Java SE, which is located at:

http://java.sun.com/javase/downloads/index.jsp

Scroll down the page and look for the latest update to the "Java Runtime Environment (JRE) 5.0". At the time of this writing, the current update is 9. Click on the Download button, click the radio button to accept the license agreement, and choose the "Linux self-extracting file" link, which corresponds to jre-1_5_0_09-linux-i586.bin. After it downloads, move the file to /opt:

~> sudo mv ~/Desktop/jre-*.bin /opt
Now change into the /opt directory:
~> cd /opt
And change the permissions of the file so that it is executable:
~> sudo chmod ugo+x jre-*.bin
Next, run the binary file using sudo:
~> sudo ./jre-*.bin
Continue to press the space bar until you scroll down to the end of the license agreement. Type "yes" and hit Enter. Wait for the installation to complete, and delete the binary file:
~> sudo rm jre-*.bin
Configuring the Java plugin
To configure the Java plugin, simply create the appropriate soft link to /usr/lib/mozilla/plugins:

~> sudo ln -s /opt/jre1.5.0_09/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/.
Restart Firefox to enable the Java plugin. To test it, go to http://www.java.com/en/download/help/testvm.xml.

Configuring Java for Other Applications
To configure java for additional applications, we need to create a couple of profile files in /etc/profile.d. For the bash shell, create a file /etc/profile.d/java.sh with the following information:
export J2RE_HOME=/opt/jre1.5.0_09
export PATH=$J2RE_HOME/bin:$PATH
Next, create a file /etc/profile.d/java.csh for csh/tcsh shells:
set J2RE_HOME=/opt/jre1.5.0_09
set path=($J2RE_HOME/bin $path)
If you are using bash as your default shell, source the java.sh file:
$ source /etc/profile.d/java.sh
If you are using csh/tcsh as your default shell, as I am, source the java.csh file instead:
~> source /etc/profile.d/java.csh
To verify that we will use the newly installed java application, type:
~> which java
You should see:
/opt/jre1.5.0_09/bin/java
Next we will use the alternatives command to further configure FC5 to use jre1.5.0_09. Type:
~> sudo /usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.5.0_09/bin/java 2
This configures jre1.5.0_09 as an alternative to the generic java implementation that comes bundled with FC5. To choose it, type:
~> sudo /usr/sbin/alternatives --config java
in which case, you should see:
There are 2 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*  1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
 + 2           /opt/jre1.5.0_09/bin/java


Enter to keep the current selection[+], or type selection number:
Press '2' and hit Enter. Finally, type:
~> sudo /usr/sbin/alternatives --display java
You should see that the link currently points to /opt/jre1.5.0_09/bin/java:
java - status is manual.
 link currently points to /opt/jre1.5.0_09/bin/java
/usr/lib/jvm/jre-1.4.2-gcj/bin/java - priority 1420
 slave rmiregistry: /usr/lib/jvm/jre-1.4.2-gcj/bin/rmiregistry
 slave jre_exports: /usr/lib/jvm-exports/jre-1.4.2-gcj
 slave jre: /usr/lib/jvm/jre-1.4.2-gcj
/opt/jre1.5.0_09/bin/java - priority 2
 slave rmiregistry: (null)
 slave jre_exports: (null)
 slave jre: (null)
Current `best' version is /usr/lib/jvm/jre-1.4.2-gcj/bin/java.
You are now able to install and run Java applications!