Install Sun/Oracle Java JDK/JRE 6u45 on Fedora 19/18, CentOS/RHEL 6.4/5.9

java-logo
Please note: This guide still working normally if you want install Sun/Oracle Java 6, but if you want Java 8 version, then check Install Oracle Java JDK/JRE 8 on Fedora, CentOS/RHEL or if you want Java 7 version, then check Howto Install Sun/Oracle Java JDK/JRE 7 on Fedora, CentOS/Red Hat (RHEL).

By default, Fedora 19/18/17/16/15/14/13/12 and CentOS/Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9 Linux operating systems use the OpenJDK Java, which is a good choice for normal use and it works with almost all the Java programs normally. OpenJDK is also easy to install and maintain with YUM package management, but some cases, Sun/Oracle Java installation is necessary, for example, if some program have to compile with Sun/Oracle Java or a particular program does not work without Sun/Oracle Java.

This is guide, howto install Oracle Java JDK/JRE 6u45 on Fedora 19/18/17/16/15/14/13/12, CentOS/RHEL 6.4/6.3/6.2/6.1/6/5.9.

Install Sun/Oracle Java JDK/JRE 6u45 on Fedora 19/18/17/16/15/14/13/12 CentOS 6.4/6.3/6.2/6.1/6/5.9, Red Hat (RHEL) 6.4/6.3/6.2/6.1/6/5.9

1. Download Sun/Oracle Java JDK or JRE RPMs

Download Sun/Oracle Java JDK or JRE from here (current version is JDK 6 Update 45) http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u45-oth-JPR.
Note: Select rpm.bin package (example jdk-6u45-linux-i586-rpm.bin, jre-6u45-linux-i586-rpm.bin, jdk-6u45-linux-x64-rpm.bin or jre-6u45-linux-x64-rpm.bin).

2. Change to root user.

sudo -i
## OR ##
su -

3a. Run Sun/Oracle Java JDK binary

chmod +x /path/to/file/jdk-6u45-linux-*-rpm.bin
/path/to/binary/jdk-6u45-linux-*-rpm.bin
 
## OR ##
 
sh /path/to/binary/jdk-6u45-linux-*-rpm.bin

Note: Use full file name (without asterix) if you have both i586 and x64 versions downloaded.

3b. Run Sun/Oracle Java JRE binary

chmod +x /path/to/file/jre-6u45-linux-*-rpm.bin
/path/to/binary/jre-6u45-linux-*-rpm.bin
 
## OR ##
 
sh /path/to/binary/jre-6u45-linux-*-rpm.bin

Note: Use full file name (without asterix) if you have both i586 and x64 versions downloaded.

4a. Install Sun/Oracle JDK java, javaws, libjavaplugin.so (for Firefox/Mozilla) and javac with alternatives –install command

## java ##
alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_45/jre/bin/java 20000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_45/jre/bin/javaws 20000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.6.0_45/jre/lib/i386/libnpjp2.so 20000
 
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk1.6.0_45/jre/lib/amd64/libnpjp2.so 20000
 
## Install javac only if you installed JDK (Java Development Kit) package ##
alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_45/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_45/bin/jar 20000

4b. Install Sun/Oracle JRE java, javaws and libjavaplugin.so (for Firefox/Mozilla) with alternatives –install command

## java ##
alternatives --install /usr/bin/java java /usr/java/jre1.6.0_45/bin/java 20000
 
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/jre1.6.0_45/bin/javaws 20000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jre1.6.0_45/lib/i386/libnpjp2.so 20000
 
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jre1.6.0_45/lib/amd64/libnpjp2.so 20000

5. Check current java, javac, javaws and libjavaplugin.so versions

java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b04)
Java HotSpot(TM) Server VM (build 20.6-b01, mixed mode)
 
javac -version
javac 1.6.0_45
 
javaws
Java(TM) Web Start 1.6.0_45
[...]

Note: Check libjavaplugin.so with restarting Mozilla Firefox and writing about:plugins on address bar.
Java 6 Browser Plugin Running on Fedora 18 Firefox 17

Java 6 Console output on Fedora 18:
Fedora 18 Java 6 Console Output

6. Swap between OpenJDK and Sun/Oracle JDK versions

alternatives --config java   # or javac or javaws or libjavaplugin.so
There are 4 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           /usr/java/jdk1.6.0_18/jre/bin/java
 + 4           /usr/java/jdk1.6.0_45/jre/bin/java
 
Enter to keep the current selection[+], or type selection number:

Note: java with [+] is currently on use

Post-Installation Setup

Add JAVA_HOME environment variable to /etc/profile file or $HOME/.bash_profile file

## export JAVA_HOME JDK ##
export JAVA_HOME="/usr/java/jdk1.6.0_45"
 
## export JAVA_HOME JRE ##
export JAVA_HOME="/usr/java/jre1.6.0_45"
Follow If Not True Then False Updates!

127 Comments

  1. yes firefox 3.0.5 shows java plugins in about:plugins folder but when i open java supported website firefox crash and when i remove java symlink then firefox does not crash.

    • Hi Rais,

      Your install method sounds risky, if you have Firefox 3.0.5 installed from RHEL original RPMs. I recommend you to upgrade your RHEL to version 5.8 and you should get Firefox 10 RHEL patched version or alternatively install and test Firefox 17 on your user home dir and try Java plugin with it.

  2. thanks for your reply, i have downloaded RHEL 5.8 64 bit but when i install it python-ldap missing and installation end, can you give me a link for RHEL 5.8 64 bit ?
    hey you say upgrade can you tell me how can i upgrage 5.3 to 5.8 ?

    • You can download RHEL 5.8 from RHEL Download page.

      Upgrade you can actually do simple using following command:

      yum update

      If you have some important data on your system, then I recommend you to backup everything important before upgrade.

  3. Hello, I just dropped by to look at this blog. It appears really
    great and I had a good time browsing it, thank you very much for the helpful article!

  4. chrome install-6U23 what is it & uses in laptops….

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks/Pingbacks

  1. Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … | Just linux! - [...] Here is the original: Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … [...]
  2. Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … | Drakz Free Online Service - [...] here to read the rest: Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … …
  3. Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … | java - [...] więcej: Howto Install Sun Java (JDK, JRE) on Fedora, CentOS, Red Hat | if … a-very-good, centos, …
  4. Install NetBeans 6.9 on Fedora, Centos, Red Hat (RHEL) | if not true then false - [...] Sun’s Java, because I think NetBeans works faster with Sun’s Java. Here is the guide, howto install Sun’s Java …
  5. CentOS 5.5 Netinstall – Network Installation | if not true then false - [...] Installed CentOS 5.5 Linux Command LineWhat to do next?Install Adobe Flash Player 10 on CentOS 5.5Install Sun Java (JDK, …
  6. Install Eclipse SDK 3.6 (Helios) on Fedora 13, CentOS 5.5, RHEL 5.5/6 | If Not True Then False - [...] Ruby on Rails framework).Install Eclipse SDK 3.6 (Helios) on Fedora, CentOS, Red Hat (RHEL)1. Install Sun Java on Fedora, …
  7. Fedora NetInstall (Net Install) with gPXE and BFO (boot.fedoraproject.org) | If Not True Then False - [...] Google Chrome Beta or Google Chrome Unstable on Fedora 13Install Adobe Flash Player 10 on Fedora 13Install Sun Java …
  8. Upgrade to Fedora 13 from Fedora 12 with Preupgrade | If Not True Then False - [...] Google Chrome Beta or Google Chrome Unstable on Fedora 13Install Adobe Flash Player 10 on Fedora 13Install Sun Java …
  9. Red Hat 6 Installation Guide – RHEL 6 Install Screenshots | If Not True Then False - [...] Beta or Google Chrome Unstable on Red Hat (RHEL) 6Install Adobe Flash Player 10 on Red Hat (RHEL) 6Install …
  10. Android SDK and Eclipse ADT on Fedora 13, CentOS 5.5, RHEL 5.5/6 | If Not True Then False - [...] Simple Android Test Project1. Preparing Your Development Computer and Install Required softwares1.1 Install Sun/Oracle Java JDK/JRE1.2 Install Eclipse SDK …
  11. Mehrere Java-Installationen nebeneinander « linux|n00b - [...] dir diese erstklassige Anleitung zum Thema auf If not True then False an. Dort erfährst du, wie du neben …
  12. Install NetBeans IDE 7.0 Beta on Fedora 14/13, CentOS/Red Hat (RHEL) 5.5/6 - [...] Sun’s Java, because I think NetBeans works faster with Sun’s Java. Here is the guide, howto install Sun/Oracle Java …
  13. Delicious Bookmarks for December 25th through December 26th « Lâmôlabs - [...] Install Sun/Oracle Java JDK/JRE 6u23 on Fedora 14, CentOS/RHEL 5.5/6 – December 26th ( tags: java linux fedora …
  14. Michael's Tech Blog » Configure Juniper VPN connection on Fedora 15 - [...] Install Sun/Oracle Java JDK/JRE 6u25 on Fedora 15, CentOS/RHEL 5.6/6 [...]
  15. Java Packages - The UNIX and Linux Forums - [...] follow this Install Sun/Oracle Java JDK/JRE 6u27 on Fedora 15, CentOS/RHEL 5.6/6 and you get [...]
  16. Install Google Chrome with YUM on Fedora 16/15, CentOS/Red Hat (RHEL) 6 - [...] Google Chrome Unstable Web Browser on Fedora 15 64-bit with 32-bit Flash and Oracle Java plugin [...]
  17. 2 days of utter frustration trying to have java plugins seen by Firefox9 - [...] it said it would likely cause the browser to crash. I followed the last set of instructions from: http://www.if-not-true-then-false.co...-red-hat-rhel/ …