projectz

Tech, Gadgets, Photography, Social Media and Poor Spelling

Install Sun/Oracle Java JDK /JRE 6u32 on Fedora 16/15/14/13/12 CentOS 6.2/6.1/6/5.8, Red Hat (RHEL) 6.2/6.1/6/5.8

Install Sun/Oracle Java JDK /JRE 6u32 on Fedora 16/15/14/13/12 CentOS 6.2/6.1/6/5.8, Red Hat (RHEL) 6.2/6.1/6/5.8

1. Download Sun/Oracle Java JDK or JRE RPMs

Download Sun/Oracle Java JDK or JRE from here (current version is JDK 6 Update 32)http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Note: Select rpm.bin package (example jdk-6u32-linux-i586-rpm.bin, jre-6u32-linux-i586-rpm.bin, jdk-6u32-linux-x64-rpm.bin or jre-6u32-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-6u32-linux-*-rpm.bin
/path/to/binary/jdk-6u32-linux-*-rpm.bin
 
## OR ##
 
sh /path/to/binary/jdk-6u32-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-6u32-linux-*-rpm.bin
/path/to/binary/jre-6u32-linux-*-rpm.bin
 
## OR ##
 
sh /path/to/binary/jre-6u32-linux-*-rpm.bin

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

4a. Install Sun/Oracle JDK javajavawslibjavaplugin.so (for Firefox/Mozilla) and javacwith alternatives –install command

## java ##
alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_32/jre/bin/java 20000
## javaws (32-bit only) ##
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.6.0_32/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_32/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_32/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_32/bin/javac 20000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.6.0_32/bin/jar 20000

4b. Install Sun/Oracle JRE javajavaws and libjavaplugin.so (for Firefox/Mozilla) withalternatives –install command

## java ##
alternatives --install /usr/bin/java java /usr/java/jre1.6.0_32/bin/java 20000
 
## javaws (32-bit only) ##
alternatives --install /usr/bin/javaws javaws /usr/java/jre1.6.0_32/bin/javaws 20000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jre1.6.0_32/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_32/lib/amd64/libnpjp2.so 20000

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

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

Note: Check libjavaplugin.so with restarting Mozilla Firefox and writing about:plugins on address bar.

Check Sun Java Vrowser Plugin Installed on Firefox

Fedora 15:
Oracle/Sun Java installed on Fedora 15 64-bit

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_32/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_32"
 
## export JAVA_HOME JRE ##
export JAVA_HOME="/usr/java/jre1.6.0_32"
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on May 22, 2012 by in link and tagged , , , , , , , , .
%d bloggers like this: