Article Index
Fedora 11 Installation and Post 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
Page 14
All Pages

25. JAVA

Fedora 11 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 java-*-openjdk-plugin'

* SUN's JAVA

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 13'.

**Note: If you also want to compile java programs using Sun's Java Development Kit Installation you must download the 'JDK 6 Update 13' file. Accept the agreement and download the Linux .bin file (not the rpm.bin 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). Java 6 Update 13 now fully supports 64bit Linux systems as well! 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 6u14 was the latest version, replace it with the file you have downloaded if it has changed):

su -
cd /home/yourusername/Download/
mv jre-6u14-linux-i586.bin /opt
cd /opt/
chmod a+x jre-6u14-linux-i586.bin
./jre-6u14-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_14/plugin/i386/ns7/libjavaplugin_oji.so \
/usr/lib/mozilla/plugins/libjavaplugin_oji.so'


Restart Firefox and Tools -> Addons -> Plugins. If the plugin was 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/java.sh


In that file copy the following:

export JAVA_HOME=/opt/jre1.6.0_14
export PATH=$JAVA_HOME/bin:$PATH


Save and exit. Next type:

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


Here you should see something like this:

There is 1 programs whic provide 'java'.
Selection     Command
-----------------------------------------------
*+ 1         /usr/lib/jvm/jre-1.6.0-openjdk/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 1 so in the next command I will use 2 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_14/bin/java 2
alternatives --config java


Now you should get something like this:

There are 2 programs which provide 'java'.
Selection     Command
-----------------------------------------------
*+ 1         /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
    
2         /opt/jre1.6.0_14/bin/java
Enter to keep the current selection[+], or type selection number:


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

java -version


You should get something like that:

java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b03)
Java HotSpot(TM) Client VM (build 11.3-b02, 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_14/bin/java'


At any time you can easily change between OpenJDK, 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/libjavaplugin.so \
libjavaplugin.so /opt/jre1.6.0_14/plugin/i386/ns7/libjavaplugin_oji.so 2
alternatives --config libjavaplugin.so


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



Linux

Login Form

Follow me on...

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

Member Login