CSUF LogoCSUF Site Navigation
optics.csufresno.edu

F9 Multimedia-Based Applications & Setup Java

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

Starting with Fedora 9, OpenJDK is now available directly (adapted from Sun Java):



Fedora 9 includes OpenJDK 6, an open source implementation of the Java Platform, Standard Edition. OpenJDK 6 is not yet Java compatible; work is underway to certify it.

Fedora will track Sun's stable OpenJDK 6 branch.




See the release notes for Fedora 9. However, I still prefer installing JRE since OpenJDK is not fully compatible to Java. In addition, 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 6". 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
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.6.0_06
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_06
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, 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 F9 to use jre1.6.0_06. Type:
~> sudo /usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.6.0_06/bin/java 3
This configures jre1.6.0_06 as an alternative to the generic java implementation that comes bundled with F9 and OpenJDK. 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.6.0-openjdk/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
   3           /opt/jre1.6.0_06/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_06/bin/java
...
You are now able to install and run Java applications!