CSUF LogoCSUF Site Navigation
optics.csufresno.edu

F8 Multimedia-Based Applications & Setup Java

Department of Electrical and Computer Engineering
Assistant Professor Gregory R. Kriehn
Forums
Wiki
F8 Java

Starting with Fedora 8, IcedTea is now available (adapted from OpenJDK from Sun):



This release of Fedora includes the IcedTea environment. IcedTea is a build harness for Sun's OpenJDK code that replaces encumbered parts of OpenJDK with Free Software replacements. IcedTea provides a more complete, compatible environment than GCJ, including support for building and running bytecode up to the 1.6 level.



See the release notes for Fedora 8. However, I still prefer installing JRE. Since it is still not recommended to use the Sun Java RPM, we will install it by hand 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) 6 Update 4". Click on the Download button, choose Linux under Platform, and click the button to accept the license agreement.  Then click Continue. Choose the "Linux self-extracting file" link, which corresponds to jre-6u4-linux-i586.bin. After it downloads, copy the file to /opt:

~> sudo cp ~/Download/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
Evidentially there is a bug in one of the libraries, but it can be fixed with the following commands:
~> cd jre1.6*/lib/i386/xawt/
~> sudo cp libmawt.so libmawt.so.orig
~> sudo sed -i 's/XINERAMA/FAKEEXTN/g' libmawt.so
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.6*/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.

NOTE:  The compat-libstdc++-33 libraries are required for the Java plugin to work.  If it is not installed, use yum:

~> sudo yum install compat-libstdc++-33
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.6.0_04
export PATH=$J2RE_HOME/bin:$PATH
Next, create a file /etc/profile.d/java.csh for csh/tcsh shells:
set J2RE_HOME=/opt/jre1.6.0_02
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.6.0_02/bin/java
Next we will use the alternatives command to further configure F8 to use jre1.6.0_04. Type:
~> sudo /usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.6.0_02/bin/java 3
This configures jre1.6.0_04 as an alternative to the generic java implementation that comes bundled with F8 and IcedTea. To choose it, type:
~> sudo /usr/sbin/alternatives --config java
in which case, you should see:
There are 3 programs which provide 'java'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-icedtea/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
   3           /opt/jre1.6.0_04/bin/java

Enter to keep the current selection[+], or type selection number:
Press '3' and hit Enter. Finally, type:
~> sudo /usr/sbin/alternatives --display java
You should see that the link currently points to /opt/jre1.6.0_02/bin/java:
java - status is manual.
 link currently points to /opt/jre1.6.0_04/bin/java
...
You are now able to install and run Java applications!