Howto install proprietary Java from Oracle

From Rosalab Wiki
Jump to: navigation, search
Many thanks to user viking who wrote this howto :)

Due to the fact that package get-jre7-oracle was removed from ABF because of Oracle licensing policy ROSA users now have to download and install Oracle Java packages from the official Oracle site.

This HOWTO is based on original RH tutorial awailble on this link: http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/

You can download the official Oracle Java RPMs from http://www.oracle.com/technetwork/java/javase/downloads/index.html . You can also use tar.gz packages from same place.

Idea.png
Note
If you can install appropriate RPM package (jdk-7u6-linux-i586.rpm, jdk-7u6-linux-x64.rpm, jre-7u6-linux-i586.rpm or jre-7u6-linux-x64.rpm), you can skip steps from 1 to 6, but steps from 7 to the end have to be done even in that case.

If you use RPMs, be prepared that you will get error like this after install

installing jre-7u6-linux-x64.rpm
Preparing...
#####################################################################################################
1/1: jre                   
#####################################################################################################
Unpacking JAR files...
rt.jar...
Error: Could not open input file: /usr/java/jre1.7.0_06/lib/rt.pack
jsse.jar...
Error: Could not open input file: /usr/java/jre1.7.0_06/lib/jsse.pack
charsets.jar...
Error: Could not open input file: /usr/java/jre1.7.0_06/lib/charsets.pack
localedata.jar...
Error: Could not open input file: /usr/java/jre1.7.0_06/lib/ext/localedata.pack

Just ignore that message, and skip steps 4 to 6.

If you use tar.gz packages, just skip step R4 (RPM installation).

Everything else is same in both cases.

Contents

JRE 7u6 64bit

1. Download jre-7u6-linux-x64.tar.gz from

http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1637588.html

2. Type

su -

and provide root passwrod

3. Go to /home/<your username>/Downloads or whatever folder you've downloaded the package to

4. Remove JRE 7u6 and links named latest and default

rm -rf /usr/java/jre1.7.0_06
rm -f /usr/java/latest
rm -f /usr/java/default 

5. Extract package to appropriate folder

tar -xzf jre-7u6-linux-x64.tar.gz -C /usr/java/ --no-same-owner

6. Make symbolic links for latest and default

ln -sf ./jre1.7.0_06 /usr/java/latest
ln -sf ./latest /usr/java/default

R4. Install RPM package

urpmi jre-7u6-linux-x64.rpm

7. Install Browser Plugins

alternatives --install /usr/lib64/xulrunner-5.0/plugins/libjavaplugin.so xulrunner-1.9-javaplugin.so  /usr/java/jre1.7.0_06/lib/amd64/libnpjp2.so 17065
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so  /usr/java/jre1.7.0_06/lib/amd64/libnpjp2.so 17065

8. Install JRE and man pages

 alternatives --install /usr/bin/ControlPanel ControlPanel /usr/java/jre1.7.0_06/bin/ControlPanel 17065
alternatives --install /usr/bin/java java /usr/java/jre1.7.0_06/bin/java 17065 --slave /usr/share/man/man1/java.1 java.1  /usr/java/jre1.7.0_06/man/man1/java.1
alternatives --install /usr/bin/java_vm java_vm /usr/java/jre1.7.0_06/bin/java_vm 17065
alternatives --install /usr/bin/javaws javaws /usr/java/jre1.7.0_06/bin/javaws 17065 --slave /usr/share/man/man1/javaws.1 javaws.1         /usr/java/jre1.7.0_06/man/ma n1/javaws.1
alternatives --install /usr/bin/jcontrol jcontrol /usr/java/jre1.7.0_06/bin/jcontrol 17065
alternatives --install /usr/bin/keytool keytool /usr/java/jre1.7.0_06/bin/keytool 17065 --slave /usr/share/man/man1/keytool.1  keytool.1 /usr/java/jre1.7.0_06/man/man1/keytool.1
alternatives --install /usr/bin/orbd orbd /usr/java/jre1.7.0_06/bin/orbd 17065 --slave /usr/share/man/man1/orbd.1 orbd.1  /usr/java/jre1.7.0_06/man/man1/orbd.1
alternatives --install /usr/bin/pack200 pack200 /usr/java/jre1.7.0_06/bin/pack200 17065 --slave /usr/share/man/man1/pack200.1   pack200.1 /usr/java/jre1.7.0_06/man/man1/pack200.1
alternatives --install /usr/bin/policytool policytool /usr/java/jre1.7.0_06/bin/policytool 17065 --slave  /usr/share/man/man1/policytool.1 policytool.1 /usr/java/jre1.7.0_06/man/man1/policytool.1
alternatives --install /usr/bin/rmid rmid /usr/java/jre1.7.0_06/bin/rmid 17065 --slave /usr/share/man/man1/rmid.1 rmid.1  /usr/java/jre1.7.0_06/man/man1/rmid.1
alternatives --install /usr/bin/rmiregistry rmiregistry /usr/java/jre1.7.0_06/bin/rmiregistry 17065 --slave  /usr/share/man/man1/rmiregistry.1 rmiregistry.1 /usr/java/jre1.7.0_06/man/man1/rmiregistry.1
alternatives --install /usr/bin/servertool servertool /usr/java/jre1.7.0_06/bin/servertool 17065 --slave    /usr/share/man/man1/servertool.1 servertool.1 /usr/java/jre1.7.0_06/man/man1/servertool.1
alternatives --install /usr/bin/tnameserv tnameserv /usr/java/jre1.7.0_06/bin/tnameserv 17065 --slave  /usr/share/man/man1/tnameserv.1 tnameserv.1 /usr/java/jre1.7.0_06/man/man1/tnameserv.1
alternatives --install /usr/bin/unpack200 unpack200 /usr/java/jre1.7.0_06/bin/unpack200 17065 --slave  /usr/share/man/man1/unpack200.1 unpack200.1 /usr/java/jre1.7.0_06/man/man1/unpack200.1

9. Export JAVA_HOME

alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 20000

JRE 7u6 32bit

1. Download jre-7u6-linux-i586.tar.gz from http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1637588.html

2. Type

su -

and provide root password 3. Go to /home/<your username>/Downloads

4. Remove JRE 7u6 and links named latest and default

rm -rf /usr/java/jre1.7.0_06
rm -f /usr/java/latest
rm -f /usr/java/default 

5. Extract package to appropriate folder

tar -xzf jre-7u6-linux-i586.tar.gz -C /usr/java/ --no-same-owner

6. Make symbolic links for latest and default

ln -sf ./jre1.7.0_06 /usr/java/latest
ln -sf ./latest /usr/java/default

R4. Install RPM package

urpmi jre-7u6-linux-i586.rpm

7. Install Browser Plugins

alternatives --install /usr/lib/xulrunner-5.0/plugins/libjavaplugin.so xulrunner-1.9-javaplugin.so  /usr/java/jre1.7.0_06/lib/i386/libnpjp2.so 17065
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /usr/java/jre1.7.0_06/lib/i386/libnpjp2.so  17065

8. Install JRE and man pages

alternatives --install /usr/bin/ControlPanel ControlPanel /usr/java/jre1.7.0_06/bin/ControlPanel 17065
alternatives --install /usr/bin/java java /usr/java/jre1.7.0_06/bin/java 17065 --slave /usr/share/man/man1/java.1 java.1  /usr/java/jre1.7.0_06/man/man1/java.1
alternatives --install /usr/bin/java_vm java_vm /usr/java/jre1.7.0_06/bin/java_vm 17065
alternatives --install /usr/bin/javaws javaws /usr/java/jre1.7.0_06/bin/javaws 17065 --slave /usr/share/man/man1/javaws.1 javaws.1  /usr/java/jre1.7.0_06/man/man1/javaws.1
alternatives --install /usr/bin/jcontrol jcontrol /usr/java/jre1.7.0_06/bin/jcontrol 17065
alternatives --install /usr/bin/keytool keytool /usr/java/jre1.7.0_06/bin/keytool 17065 --slave /usr/share/man/man1/keytool.1  keytool.1 /usr/java/jre1.7.0_06/man/man1/keytool.1
alternatives --install /usr/bin/orbd orbd /usr/java/jre1.7.0_06/bin/orbd 17065 --slave /usr/share/man/man1/orbd.1 orbd.1  /usr/java/jre1.7.0_06/man/man1/orbd.1
alternatives --install /usr/bin/pack200 pack200 /usr/java/jre1.7.0_06/bin/pack200 17065 --slave /usr/share/man/man1/pack200.1  pack200.1 /usr/java/jre1.7.0_06/man/man1/pack200.1
alternatives --install /usr/bin/policytool policytool /usr/java/jre1.7.0_06/bin/policytool 17065 --slave  /usr/share/man/man1/policytool.1 policytool.1 /usr/java/jre1.7.0_06/man/man1/policytool.1
alternatives --install /usr/bin/rmid rmid /usr/java/jre1.7.0_06/bin/rmid 17065 --slave /usr/share/man/man1/rmid.1 rmid.1 /usr/java/jre1.7.0_06/man/man1/rmid.1
alternatives --install /usr/bin/rmiregistry rmiregistry /usr/java/jre1.7.0_06/bin/rmiregistry 17065 --slave /usr/share/man/man1/rmiregistry.1 rmiregistry.1 /usr/java/jre1.7.0_06/man/man1/rmiregistry.1
alternatives --install /usr/bin/servertool servertool /usr/java/jre1.7.0_06/bin/servertool 17065 --slave /usr/share/man/man1/servertool.1 servertool.1 /usr/java/jre1.7.0_06/man/man1/servertool.1
alternatives --install /usr/bin/tnameserv tnameserv /usr/java/jre1.7.0_06/bin/tnameserv 17065 --slave /usr/share/man/man1/tnameserv.1 tnameserv.1 /usr/java/jre1.7.0_06/man/man1/tnameserv.1
alternatives --install /usr/bin/unpack200 unpack200 /usr/java/jre1.7.0_06/bin/unpack200 17065 --slave /usr/share/man/man1/unpack200.1 unpack200.1 /usr/java/jre1.7.0_06/man/man1/unpack200.1

9. Export JAVA_HOME

export JAVA_HOME="/usr/java/jre1.7.0_06"

If you need JDK instead of JRE, then you have to do something very similar.

JDK 7u6 64bit

1. Download jdk-7u6-linux-x64.tar.gz from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html

2. Type

su -

and provide root password

3. Go to /home/<your username>/Downloads or whatever folder you've downloaded the package to

4. Remove JRE 7u6 and links named latest and default

rm -rf /usr/java/jdk1.7.0_06
rm -f /usr/java/latest
rm -f /usr/java/default 

5. Extract package to appropriate folder

tar -xzf jdk-7u6-linux-x64.tar.gz -C /usr/java/ --no-same-owner

6. Make symbolic links for latest and default

ln -sf ./jdk1.7.0_06 /usr/java/latest
ln -sf ./latest /usr/java/default

R4. Install RPM package

urpmi jdk-7u6-linux-x64.rpm

7. Install Browser Plugins

alternatives --install /usr/lib64/xulrunner-5.0/plugins/libjavaplugin.so xulrunner-1.9-javaplugin.so /usr/java/jdk1.7.0_06/jre/lib/amd64/libnpjp2.so 17069
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /usr/java/jdk1.7.0_06/jre/lib/amd64/libnpjp2.so 17069

8. Install JDK and man pages

alternatives --install /usr/bin/appletviewer appletviewer /usr/java/jdk1.7.0_06/bin/appletviewer 17069 --slave /usr/share/man/man1/appletviewer.1 appletviewer.1 /usr/java/jdk1.7.0_06/man/man1/appletviewer.1
alternatives --install /usr/bin/apt apt /usr/java/jdk1.7.0_06/bin/apt 17069 --slave /usr/share/man/man1/apt.1 apt.1 /usr/java/jdk1.7.0_06/man/man1/apt.1
alternatives --install /usr/bin/extcheck extcheck /usr/java/jdk1.7.0_06/bin/extcheck 17069 --slave /usr/share/man/man1/extcheck.1 extcheck.1 /usr/java/jdk1.7.0_06/man/man1/extcheck.1
alternatives --install /usr/bin/idlj idlj /usr/java/jdk1.7.0_06/bin/idlj 17069 --slave /usr/share/man/man1/idlj.1 idlj.1 /usr/java/jdk1.7.0_06/man/man1/idlj.1
alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_06/bin/jar 17069 --slave /usr/share/man/man1/jar.1 jar.1 /usr/java/jdk1.7.0_06/man/man1/jar.1
alternatives --install /usr/bin/jarsigner jarsigner /usr/java/jdk1.7.0_06/bin/jarsigner 17069 --slave  /usr/share/man/man1/jarsigner.1 jarsigner.1 /usr/java/jdk1.7.0_06/man/man1/jarsigner.1
alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_06/bin/javac 17069 --slave /usr/share/man/man1/javac.1 javac.1  /usr/java/jdk1.7.0_06/man/man1/javac.1
alternatives --install /usr/bin/javadoc javadoc /usr/java/jdk1.7.0_06/bin/javadoc 17069 --slave /usr/share/man/man1/javadoc.1  javadoc.1 /usr/java/jdk1.7.0_06/man/man1/javadoc.1
alternatives --install /usr/bin/javafxpackager javafxpackager /usr/java/jdk1.7.0_06/bin/javafxpackager 17069 --slave  /usr/share/man/man1/javafxpackager.1 javafxpackager.1 /usr/java/jdk1.7.0_06/man/man1/javafxpackager.1
alternatives --install /usr/bin/javah javah /usr/java/jdk1.7.0_06/bin/javah 17069 --slave /usr/share/man/man1/javah.1 javah.1  /usr/java/jdk1.7.0_06/man/man1/javah.1
alternatives --install /usr/bin/javap javap /usr/java/jdk1.7.0_06/bin/javap 17069 --slave /usr/share/man/man1/javap.1 javap.1  /usr/java/jdk1.7.0_06/man/man1/javap.1
alternatives --install /usr/bin/jcmd jcmd /usr/java/jdk1.7.0_06/bin/jcmd 17069 --slave /usr/share/man/man1/jcmd.1 jcmd.1  /usr/java/jdk1.7.0_06/man/man1/jcmd.1
alternatives --install /usr/bin/jconsole jconsole /usr/java/jdk1.7.0_06/bin/jconsole 17069 --slave /usr/share/man/man1/jconsole.1  jconsole.1 /usr/java/jdk1.7.0_06/man/man1/jconsole.1
alternatives --install /usr/bin/jdb jdb /usr/java/jdk1.7.0_06/bin/jdb 17069 --slave /usr/share/man/man1/jdb.1 jdb.1  /usr/java/jdk1.7.0_06/man/man1/jdb.1
alternatives --install /usr/bin/jhat jhat /usr/java/jdk1.7.0_06/bin/jhat 17069 --slave /usr/share/man/man1/jhat.1 jhat.1  /usr/java/jdk1.7.0_06/man/man1/jhat.1
alternatives --install /usr/bin/jinfo jinfo /usr/java/jdk1.7.0_06/bin/jinfo 17069 --slave /usr/share/man/man1/jinfo.1 jinfo.1  /usr/java/jdk1.7.0_06/man/man1/jinfo.1
alternatives --install /usr/bin/jmap jmap /usr/java/jdk1.7.0_06/bin/jmap 17069 --slave /usr/share/man/man1/jmap.1 jmap.1  /usr/java/jdk1.7.0_06/man/man1/jmap.1
alternatives --install /usr/bin/jps jps /usr/java/jdk1.7.0_06/bin/jps 17069 --slave /usr/share/man/man1/jps.1 jps.1  /usr/java/jdk1.7.0_06/man/man1/jps.1
alternatives --install /usr/bin/jrunscript jrunscript /usr/java/jdk1.7.0_06/bin/jrunscript 17069 --slave  /usr/share/man/man1/jrunscript.1 jrunscript.1 /usr/java/jdk1.7.0_06/man/man1/jrunscript.1
alternatives --install /usr/bin/jsadebugd jsadebugd /usr/java/jdk1.7.0_06/bin/jsadebugd 17069 --slave  /usr/share/man/man1/jsadebugd.1 jsadebugd.1 /usr/java/jdk1.7.0_06/man/man1/jsadebugd.1
alternatives --install /usr/bin/jstack jstack /usr/java/jdk1.7.0_06/bin/jstack 17069 --slave /usr/share/man/man1/jstack.1 jstack.1  /usr/java/jdk1.7.0_06/man/man1/jstack.1
alternatives --install /usr/bin/jstat jstat /usr/java/jdk1.7.0_06/bin/jstat 17069 --slave /usr/share/man/man1/jstat.1 jstat.1  /usr/java/jdk1.7.0_06/man/man1/jstat.1
alternatives --install /usr/bin/jstatd jstatd /usr/java/jdk1.7.0_06/bin/jstatd 17069 --slave /usr/share/man/man1/jstatd.1 jstatd.1  /usr/java/jdk1.7.0_06/man/man1/jstatd.1
alternatives --install /usr/bin/native2ascii native2ascii /usr/java/jdk1.7.0_06/bin/native2ascii 17069 --slave  /usr/share/man/man1/native2ascii.1 native2ascii.1 /usr/java/jdk1.7.0_06/man/man1/native2ascii.1
alternatives --install /usr/bin/rmic rmic /usr/java/jdk1.7.0_06/bin/rmic 17069 --slave /usr/share/man/man1/rmic.1 rmic.1  /usr/java/jdk1.7.0_06/man/man1/rmic.1
alternatives --install /usr/bin/schemagen schemagen /usr/java/jdk1.7.0_06/bin/schemagen 17069 --slave  /usr/share/man/man1/schemagen.1 schemagen.1 /usr/java/jdk1.7.0_06/man/man1/schemagen.1
alternatives --install /usr/bin/serialver serialver /usr/java/jdk1.7.0_06/bin/serialver 17069 --slave  /usr/share/man/man1/serialver.1 serialver.1 /usr/java/jdk1.7.0_06/man/man1/serialver.1
alternatives --install /usr/bin/wsgen wsgen /usr/java/jdk1.7.0_06/bin/wsgen 17069 --slave /usr/share/man/man1/wsgen.1 wsgen.1  /usr/java/jdk1.7.0_06/man/man1/wsgen.1
alternatives --install /usr/bin/wsimport wsimport /usr/java/jdk1.7.0_06/bin/wsimport 17069 --slave /usr/share/man/man1/wsimport.1  wsimport.1 /usr/java/jdk1.7.0_06/man/man1/wsimport.1
alternatives --install /usr/bin/xjc xjc /usr/java/jdk1.7.0_06/bin/xjc 17069 --slave /usr/share/man/man1/xjc.1 xjc.1  /usr/java/jdk1.7.0_06/man/man1/xjc.1
alternatives --install /usr/bin/jexec jexec /usr/java/jdk1.7.0_06/jre/lib/jexec 17069
alternatives --install /usr/bin/java-rmi.cgi java-rmi.cgi /usr/java/jdk1.7.0_06/bin/java-rmi.cgi 17069
alternatives --install /usr/bin/ControlPanel ControlPanel /usr/java/jdk1.7.0_06/jre/bin/ControlPanel 17069
alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_06/jre/bin/java 17069 --slave /usr/share/man/man1/java.1 java.1  /usr/java/jdk1.7.0_06/man/man1/java.1 
alternatives --install /usr/bin/java_vm java_vm /usr/java/jdk1.7.0_06/jre/bin/java_vm 17069
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_06/jre/bin/javaws 17069 --slave /usr/share/man/man1/javaws.1  javaws.1 /usr/java/jdk1.7.0_06/man/man1/javaws.1
alternatives --install /usr/bin/jcontrol jcontrol /usr/java/jdk1.7.0_06/jre/bin/jcontrol 17069
alternatives --install /usr/bin/keytool keytool /usr/java/jdk1.7.0_06/jre/bin/keytool 17069 --slave /usr/share/man/man1/keytool.1  keytool.1 /usr/java/jdk1.7.0_06/man/man1/keytool.1
alternatives --install /usr/bin/orbd orbd /usr/java/jdk1.7.0_06/jre/bin/orbd 17069 --slave /usr/share/man/man1/orbd.1 orbd.1  /usr/java/jdk1.7.0_06/man/man1/orbd.1
alternatives --install /usr/bin/pack200 pack200 /usr/java/jdk1.7.0_06/jre/bin/pack200 17069 --slave /usr/share/man/man1/pack200.1  pack200.1 /usr/java/jdk1.7.0_06/man/man1/pack200.1
alternatives --install /usr/bin/policytool policytool /usr/java/jdk1.7.0_06/jre/bin/policytool 17069 --slave  /usr/share/man/man1/policytool.1 policytool.1 /usr/java/jdk1.7.0_06/man/man1/policytool.1
alternatives --install /usr/bin/rmid rmid /usr/java/jdk1.7.0_06/jre/bin/rmid 17069 --slave /usr/share/man/man1/rmid.1 rmid.1 /usr/java/jdk1.7.0_06/man/man1/rmid.1
alternatives --install /usr/bin/rmiregistry rmiregistry /usr/java/jdk1.7.0_06/jre/bin/rmiregistry 17069 --slave /usr/share/man/man1/rmiregistry.1 rmiregistry.1 /usr/java/jdk1.7.0_06/man/man1/rmiregistry.1
alternatives --install /usr/bin/servertool servertool /usr/java/jdk1.7.0_06/jre/bin/servertool 17069 --slave /usr/share/man/man1/servertool.1 servertool.1 /usr/java/jdk1.7.0_06/man/man1/servertool.1
alternatives --install /usr/bin/tnameserv tnameserv /usr/java/jdk1.7.0_06/jre/bin/tnameserv 17069 --slave /usr/share/man/man1/tnameserv.1 tnameserv.1 /usr/java/jdk1.7.0_06/man/man1/tnameserv.1
alternatives --install /usr/bin/unpack200 unpack200 /usr/java/jdk1.7.0_06/jre/bin/unpack200 17069 --slave /usr/share/man/man1/unpack200.1 unpack200.1 /usr/java/jdk1.7.0_06/man/man1/unpack200.1

9. Export JAVA_HOME

export JAVA_HOME="/usr/java/jdk1.7.0_06"

JDK 7u6 32bit

1. Download jdk-7u6-linux-i586.tar.gz from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html

2. Type

su -

and provide root passwrod

3. Go to /home/<your username>/Downloads or whatever folder you've downloaded the package to

4. Remove JRE 7u6 and links named latest and default

rm -rf /usr/java/jdk1.7.0_06
rm -f /usr/java/latest
rm -f /usr/java/default 

5. Extract package to appropriate folder

tar -xzf jdk-7u6-linux-i586.tar.gz -C /usr/java/ --no-same-owner

6. Make symbolic links for latest and default

ln -sf ./jdk1.7.0_06 /usr/java/latest
ln -sf ./latest /usr/java/default

R4. Install RPM package

urpmi jdk-7u6-linux-i586.rpm

7. Install Browser Plugins

alternatives --install /usr/lib/xulrunner-5.0/plugins/libjavaplugin.so xulrunner-1.9-javaplugin.so /usr/java/jdk1.7.0_06/jre/lib/i386/libnpjp2.so 17069
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so mozilla-javaplugin.so /usr/java/jdk1.7.0_06/jre/lib/i386/libnpjp2.so 17069

8. Install JDK and man pages

alternatives --install /usr/bin/appletviewer appletviewer /usr/java/jdk1.7.0_06/bin/appletviewer 17069 --slave /usr/share/man/man1/appletviewer.1 appletviewer.1 /usr/java/jdk1.7.0_06/man/man1/appletviewer.1
alternatives --install /usr/bin/apt apt /usr/java/jdk1.7.0_06/bin/apt 17069 --slave /usr/share/man/man1/apt.1 apt.1 /usr/java/jdk1.7.0_06/man/man1/apt.1
alternatives --install /usr/bin/extcheck extcheck /usr/java/jdk1.7.0_06/bin/extcheck 17069 --slave /usr/share/man/man1/extcheck.1 extcheck.1 /usr/java/jdk1.7.0_06/man/man1/extcheck.1
alternatives --install /usr/bin/idlj idlj /usr/java/jdk1.7.0_06/bin/idlj 17069 --slave /usr/share/man/man1/idlj.1 idlj.1 /usr/java/jdk1.7.0_06/man/man1/idlj.1
alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_06/bin/jar 17069 --slave /usr/share/man/man1/jar.1 jar.1 /usr/java/jdk1.7.0_06/man/man1/jar.1
alternatives --install /usr/bin/jarsigner jarsigner /usr/java/jdk1.7.0_06/bin/jarsigner 17069 --slave /usr/share/man/man1/jarsigner.1 jarsigner.1 /usr/java/jdk1.7.0_06/man/man1/jarsigner.1
alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_06/bin/javac 17069 --slave /usr/share/man/man1/javac.1 javac.1 /usr/java/jdk1.7.0_06/man/man1/javac.1
alternatives --install /usr/bin/javadoc javadoc /usr/java/jdk1.7.0_06/bin/javadoc 17069 --slave /usr/share/man/man1/javadoc.1 javadoc.1 /usr/java/jdk1.7.0_06/man/man1/javadoc.1
alternatives --install /usr/bin/javafxpackager javafxpackager /usr/java/jdk1.7.0_06/bin/javafxpackager 17069 --slave /usr/share/man/man1/javafxpackager.1 javafxpackager.1 /usr/java/jdk1.7.0_06/man/man1/javafxpackager.1
alternatives --install /usr/bin/javah javah /usr/java/jdk1.7.0_06/bin/javah 17069 --slave /usr/share/man/man1/javah.1 javah.1 /usr/java/jdk1.7.0_06/man/man1/javah.1
alternatives --install /usr/bin/javap javap /usr/java/jdk1.7.0_06/bin/javap 17069 --slave /usr/share/man/man1/javap.1 javap.1 /usr/java/jdk1.7.0_06/man/man1/javap.1
alternatives --install /usr/bin/jcmd jcmd /usr/java/jdk1.7.0_06/bin/jcmd 17069 --slave /usr/share/man/man1/jcmd.1 jcmd.1 /usr/java/jdk1.7.0_06/man/man1/jcmd.1
alternatives --install /usr/bin/jconsole jconsole /usr/java/jdk1.7.0_06/bin/jconsole 17069 --slave /usr/share/man/man1/jconsole.1 jconsole.1 /usr/java/jdk1.7.0_06/man/man1/jconsole.1
alternatives --install /usr/bin/jdb jdb /usr/java/jdk1.7.0_06/bin/jdb 17069 --slave /usr/share/man/man1/jdb.1 jdb.1 /usr/java/jdk1.7.0_06/man/man1/jdb.1
alternatives --install /usr/bin/jhat jhat /usr/java/jdk1.7.0_06/bin/jhat 17069 --slave /usr/share/man/man1/jhat.1 jhat.1 /usr/java/jdk1.7.0_06/man/man1/jhat.1
alternatives --install /usr/bin/jinfo jinfo /usr/java/jdk1.7.0_06/bin/jinfo 17069 --slave /usr/share/man/man1/jinfo.1 jinfo.1 /usr/java/jdk1.7.0_06/man/man1/jinfo.1
alternatives --install /usr/bin/jmap jmap /usr/java/jdk1.7.0_06/bin/jmap 17069 --slave /usr/share/man/man1/jmap.1 jmap.1 /usr/java/jdk1.7.0_06/man/man1/jmap.1
alternatives --install /usr/bin/jps jps /usr/java/jdk1.7.0_06/bin/jps 17069 --slave /usr/share/man/man1/jps.1 jps.1 /usr/java/jdk1.7.0_06/man/man1/jps.1
alternatives --install /usr/bin/jrunscript jrunscript /usr/java/jdk1.7.0_06/bin/jrunscript 17069 --slave /usr/share/man/man1/jrunscript.1 jrunscript.1 /usr/java/jdk1.7.0_06/man/man1/jrunscript.1
alternatives --install /usr/bin/jsadebugd jsadebugd /usr/java/jdk1.7.0_06/bin/jsadebugd 17069 --slave /usr/share/man/man1/jsadebugd.1 jsadebugd.1 /usr/java/jdk1.7.0_06/man/man1/jsadebugd.1
alternatives --install /usr/bin/jstack jstack /usr/java/jdk1.7.0_06/bin/jstack 17069 --slave /usr/share/man/man1/jstack.1 jstack.1 /usr/java/jdk1.7.0_06/man/man1/jstack.1
alternatives --install /usr/bin/jstat jstat /usr/java/jdk1.7.0_06/bin/jstat 17069 --slave /usr/share/man/man1/jstat.1 jstat.1  /usr/java/jdk1.7.0_06/man/man1/jstat.1
alternatives --install /usr/bin/jstatd jstatd /usr/java/jdk1.7.0_06/bin/jstatd 17069 --slave /usr/share/man/man1/jstatd.1 jstatd.1 /usr/java/jdk1.7.0_06/man/man1/jstatd.1
alternatives --install /usr/bin/native2ascii native2ascii /usr/java/jdk1.7.0_06/bin/native2ascii 17069 --slave /usr/share/man/man1/native2ascii.1 native2ascii.1 /usr/java/jdk1.7.0_06/man/man1/native2ascii.1
alternatives --install /usr/bin/rmic rmic /usr/java/jdk1.7.0_06/bin/rmic 17069 --slave /usr/share/man/man1/rmic.1 rmic.1 /usr/java/jdk1.7.0_06/man/man1/rmic.1
alternatives --install /usr/bin/schemagen schemagen /usr/java/jdk1.7.0_06/bin/schemagen 17069 --slave /usr/share/man/man1/schemagen.1 schemagen.1 /usr/java/jdk1.7.0_06/man/man1/schemagen.1
alternatives --install /usr/bin/serialver serialver /usr/java/jdk1.7.0_06/bin/serialver 17069 --slave /usr/share/man/man1/serialver.1 serialver.1 /usr/java/jdk1.7.0_06/man/man1/serialver.1
alternatives --install /usr/bin/wsgen wsgen /usr/java/jdk1.7.0_06/bin/wsgen 17069 --slave /usr/share/man/man1/wsgen.1 wsgen.1  /usr/java/jdk1.7.0_06/man/man1/wsgen.1
alternatives --install /usr/bin/wsimport wsimport /usr/java/jdk1.7.0_06/bin/wsimport 17069 --slave /usr/share/man/man1/wsimport.1  wsimport.1 /usr/java/jdk1.7.0_06/man/man1/wsimport.1
alternatives --install /usr/bin/xjc xjc /usr/java/jdk1.7.0_06/bin/xjc 17069 --slave /usr/share/man/man1/xjc.1 xjc.1 /usr/java/jdk1.7.0_06/man/man1/xjc.1
alternatives --install /usr/bin/jexec jexec /usr/java/jdk1.7.0_06/jre/lib/jexec 17069
alternatives --install /usr/bin/java-rmi.cgi java-rmi.cgi /usr/java/jdk1.7.0_06/bin/java-rmi.cgi 17069
alternatives --install /usr/bin/ControlPanel ControlPanel /usr/java/jdk1.7.0_06/jre/bin/ControlPanel 17069
alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_06/jre/bin/java 17069 --slave /usr/share/man/man1/java.1 java.1 /usr/java/jdk1.7.0_06/man/man1/java.1
alternatives --install /usr/bin/java_vm java_vm /usr/java/jdk1.7.0_06/jre/bin/java_vm 17069
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0_06/jre/bin/javaws 17069 --slave /usr/share/man/man1/javaws.1 javaws.1 /usr/java/jdk1.7.0_06/man/man1/javaws.1
alternatives --install /usr/bin/jcontrol jcontrol /usr/java/jdk1.7.0_06/jre/bin/jcontrol 17069
alternatives --install /usr/bin/keytool keytool /usr/java/jdk1.7.0_06/jre/bin/keytool 17069 --slave /usr/share/man/man1/keytool.1 keytool.1 /usr/java/jdk1.7.0_06/man/man1/keytool.1
alternatives --install /usr/bin/orbd orbd /usr/java/jdk1.7.0_06/jre/bin/orbd 17069 --slave /usr/share/man/man1/orbd.1 orbd.1 /usr/java/jdk1.7.0_06/man/man1/orbd.1
alternatives --install /usr/bin/pack200 pack200 /usr/java/jdk1.7.0_06/jre/bin/pack200 17069 --slave /usr/share/man/man1/pack200.1 pack200.1 /usr/java/jdk1.7.0_06/man/man1/pack200.1
alternatives --install /usr/bin/policytool policytool /usr/java/jdk1.7.0_06/jre/bin/policytool 17069 --slave /usr/share/man/man1/policytool.1 policytool.1 /usr/java/jdk1.7.0_06/man/man1/policytool.1
alternatives --install /usr/bin/rmid rmid /usr/java/jdk1.7.0_06/jre/bin/rmid 17069 --slave /usr/share/man/man1/rmid.1 rmid.1 /usr/java/jdk1.7.0_06/man/man1/rmid.1
alternatives --install /usr/bin/rmiregistry rmiregistry /usr/java/jdk1.7.0_06/jre/bin/rmiregistry 17069 --slave /usr/share/man/man1/rmiregistry.1 rmiregistry.1 /usr/java/jdk1.7.0_06/man/man1/rmiregistry.1
alternatives --install /usr/bin/servertool servertool /usr/java/jdk1.7.0_06/jre/bin/servertool 17069 --slave /usr/share/man/man1/servertool.1 servertool.1 /usr/java/jdk1.7.0_06/man/man1/servertool.1
alternatives --install /usr/bin/tnameserv tnameserv /usr/java/jdk1.7.0_06/jre/bin/tnameserv 17069 --slave /usr/share/man/man1/tnameserv.1 tnameserv.1 /usr/java/jdk1.7.0_06/man/man1/tnameserv.1
alternatives --install /usr/bin/unpack200 unpack200 /usr/java/jdk1.7.0_06/jre/bin/unpack200 17069 --slave /usr/share/man/man1/unpack200.1 unpack200.1 /usr/java/jdk1.7.0_06/man/man1/unpack200.1

9. Export JAVA_HOME

export JAVA_HOME="/usr/java/jdk1.7.0_06"

Making Java active

Now you need to make it active (if you have more then one java installed).

alternatives --config java

Checking Java installation

You can check current java, javac, javaws and libjavaplugin.so versions like this:

java -version
javaws

And if you installed JDK

javac -version

Open http://www.java.com/en/download/installed.jsp in your browser.