Some times some application needs only Sun Java, It will refuce to work in other version (eg. OpenJDK).
CentOS, Debian/Ubuntu method
But by default OpenJDK based java was installed in my system.
[root@server2 sandbox]# java -version
java version “1.6.0_17″
OpenJDK Runtime Environment (IcedTea6 1.7.9) (rhel-1.36.b17.el6_0-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
Step 1: Donwload JDK from http://www.java.com. I got JDK version 7 in rpm format.
mohamed@SilentStorm $ ls *.rpm
jdk-7-linux-x64.rpm
Step 2: Install the RPM.
[root@server2 sandbox]# rpm -i jdk-7-linux-x64.rpm
Unpacking JAR files…
rt.jar…
jsse.jar…
charsets.jar…
tools.jar…
localedata.jar…
By default Java will be installed to /usr/java/jdk1.7.0/
Step 3: Add this new java to the alternatives configuration & Update the java alternatives
[root@server2 sandbox]# alternatives - -install /usr/bin/java java /usr/java/jdk1.7.0/bin/java 2
[root@server2 sandbox]# alternatives – -config javaThere are 3 programs which provide ‘java’.
Selection Command
———————————————–
*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
3 /usr/java/jdk1.7.0/bin/javaEnter to keep the current selection[+], or type selection number: 3
Step 4: Now verify the java version
[root@server2 sandbox]# java -version
java version “1.7.0″
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
OpenSUSE way is here
# rpm -i jdk-7-linux-i586.rpm
Unpacking JAR files…
rt.jar…
jsse.jar…
charsets.jar…
tools.jar…
localedata.jar…
plugin.jar…
javaws.jar…
deploy.jar…# update-alternatives – -install /usr/bin/java java /usr/java/jdk1.7.0/bin/java 2
# update-alternatives – -config javaThere are 3 alternatives which provide `java’.
Selection Alternative
———————————————–
*+ 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.7.0/bin/java
Press enter to keep the default[*], or type selection number: 3
Using ‘/usr/java/jdk1.7.0/bin/java’ to provide ‘java’.
# java -version
java version “1.7.0″
Congrats! you have made it.





May 25, 2012 at 9:46 PM
Exactly what I was looking for! Thanks!
April 4, 2012 at 2:14 AM
[...] Originally Posted by jb10809 Hello bigrigdriver, Thank you for sharing your insights…will try new approach ( add 32 bit java to PC and use 32 bit Firefox).
Hello, Opensuse has some default install open java implementation (open-Java), which includes IceTea, this is the plugin to run applets on FireFox. However, sometimes, you would need the Oracle java (which i have =( ). The steps are (pretty much is the same as the links that i'm providing):
1. download java instaler
2. unzip the installer (if you go for the packed) or run the RPM
3. provide a Path
4. removed the Iced-tea plugin
5. add the Java plugin into Firefox
6. start firefox
7. finally, pray =D I just performed those steps and my applets are running as should.
I'll give you some links that may be helpful: http://java.com/en/download/help/linux_install.xml http://mohammadthalif.wordpress.com/…in-centos-6-2/ [...]
March 15, 2012 at 11:09 PM
[...] ref:http://mohammadthalif.wordpress.com/2011/10/08/how-to-install-java-sun-jdk-in-centos-6-2/ If you enjoyed this article, please consider sharing it! [...]
March 7, 2012 at 4:37 AM
Works on ancient OpenSUSE 10.2 as well. Thanks, I’ve been looking for something this simple for weeks!
February 22, 2012 at 3:35 AM
[...] E-Business Suite 11i … . Debian Sid 64 e Oracle Java jre 6 e 7 « Tecnologia e non solo . How to install Sun Java JDK in CentOS 6, OpenSUSE and Debian … . Instalar JRE 1.6 con [...]
January 13, 2012 at 7:17 AM
Thank for you help!!
January 11, 2012 at 3:25 AM
Thank you for your post. How to setup alternatives for both jre and jdk?
December 14, 2011 at 5:07 PM
THANKS!!!