Article Index
Fedora 10 Installation Guide
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
Page 8
Page 9
Page 10
Page 11
Page 12
Page 13
All Pages

23. JAVA

Fedora 10 comes with java from the OpenJDK project. It is very easy to install it through yum (if it hasn't already been installed) and it works just fine. Try it! If you still want to install the Sun Java go a few lines below.

* OpenJDK

su -c 'yum install java-*-openjdk'


First you must install some libraries needed by Sun' Java. Open a console and type:

su -c 'yum install compat-libstdc++-33 compat-libstdc++-296'
When the libraries are installed create the necessary links by typing:

su -c '/sbin/ldconfig'
Now click here to go to sun's java site. Click on the download button next to 'Java Runtime Environment (JRE) 6 Update 10'.

**Note: If you also want to compile java programs using Sun's Java Development Kit Installation you must download the 'JDK 6 Update 10' file. Accept the agreement and download the Linux self-extracting file (not the RPM file). The procedure is the same as below. You only have to replace jre1 with jdk1 in the following commands.

Select your Platform (Linux for i386 Fedora or Linux x64 for Fedora x86_64). Notice that there is no 64bit Browser Java plugin at this time. Accept the agreement and press Continue.

**Note: The rest of the guide is based on the i586 package. If you have Fedora x86_64 installed you should download the Linux x64 file and replace the file names as necessary.

You must download the Linux self-extracting file (jre-6u10-linux-i586.bin) not the RPM.

Next open a terminal and go to the folder you have downloaded jre. Here it will be directory Download, Firefox's default download directory.

And type the following to install (when writing this guide 6u10 was the latest version, replace it with the file you have downloaded if it has changed):

su -
cd /home/yourusername/Download/ mv jre-6u10-linux-i586.bin /opt
cd /opt/
chmod a+x jre-6u10-linux-i586.bin

Use spacebar to read the agreement. At the end type yes to proceed with the installation.

To make Firefox use the installed plugin type:

su -c 'yum remove java-*-openjdk-plugin'
su -c 'ln -s /opt/jre1.6.0_10/plugin/i386/ns7/ /usr/lib/mozilla/plugins/'

Restart Firefox and type about:plugins in the address bar. If the plugins have successfully installed you should see Java(TM) Plug-in among the plugins.

Now, if you also want to run java programs using Sun's java type in a console:

su -
gedit /etc/profile.d/

In that file copy the following:

export JAVA_ HOME=/opt/jre1.6.0_10
export PATH=$JAVA_HOME/bin:$PATH

Save and exit. Next type:

source /etc/profile.d/
alternatives --config java

Here you should see something like this:

There are 2 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

Enter to keep the current selection[+], or type selection number:

Check how many programs provide java and press Ctrl+C. Here I have 2 so in the next command I will use 3 at the end of the command. Increase by one the number of programs that you have.

alternatives --install /usr/bin/java java /opt/jre1.6.0_10/bin/java 3
alternatives --config java

Now you should get something like this:

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:

Select the option you have entered e.g. 3. To test that you have correctly installed java type:

java -version
You should get something like that:

java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

If at some time you update your Java installation simply remove the old one by typing:

su -c 'alternatives --remove java /opt/jre1.6.0_10/bin/java'
At any time you can easily change between OpenJDK, GCJ and Sun's JAVA either by running the command

su -c 'alternatives --config java'
To be able to easily use SUN's java plugin as well type:

# alternatives --install /usr/lib/mozilla/plugins/ \ /opt/jre1.6.0_10/plugin/i386/ns7/ 2
alternatives --config

Now you can choose whatever java version you want by typing the number in front of it.


Login Form

Follow me on...

  • Facebook
  • Twitter
  • Google+: u/0/b/113039112812192417058/
  • Digg
  • Reddit: myguides
  • RSS Feed
  • e-mail

Member Login