| Article Index |
|---|
| Fedora 12 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 |
Page 13 of 14
25. JAVA
Fedora 12 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 17'.
**Note: If you also want to compile java programs using Sun's Java Development Kit Installation you must download the 'JDK 6 Update 17' 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 17 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-6u17-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 6u17 was the latest version, replace it with the file you have downloaded if it has changed):
su -
cd /home/yourusername/Download/
mv jre-6u17-linux-i586.bin /opt
cd /opt/
chmod a+x jre-6u17-linux-i586.bin
./jre-6u17-linux-i586.bin
To make Firefox use the installed plugin type:
su -c 'yum remove java-*-openjdk-plugin'
su -c 'ln -s /opt/jre1.6.0_17/plugin/i386/ns7/libjavaplugin_oji.so \
/usr/lib/mozilla/plugins/libjavaplugin_oji.so'
Now, if you also want to run java programs using Sun's java type in a console:
su -
gedit /etc/profile.d/java.sh
export JAVA_HOME=/opt/jre1.6.0_17
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile.d/java.sh
alternatives --config java
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:
alternatives --install /usr/bin/java java /opt/jre1.6.0_17/bin/java 2
alternatives --config java
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_17/bin/java
Enter to keep the current selection[+], or type selection number:
java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-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_17/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_17/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.