Table of Content

1) download jdk 7 rpm

from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

dreamcloud-opensuse:/home/oldhorse/Downloads # cd /root/Downloads/
dreamcloud-opensuse:~/Downloads # ls
.directory jdk-7u21-linux-x64.rpm

2) install jdk rpm using zypper

dreamcloud-opensuse:~/Downloads # zypper in jdk-7u21-linux-x64.rpm -y
Loading repository data...
Reading installed packages...
'-y' not found in package names. Trying capabilities.
No provider of 'y' found.
Resolving package dependencies...

The following NEW package is going to be installed:
  jdk 

1 new package to install.
Overall download size: 81.4 MiB. After the operation, additional 149.6 MiB will be used.
Continue? [y/n/?] (y): 
Retrieving package jdk-2000:1.7.0_21-fcs.x86_64                           (1/1),  81.4 MiB (149.6 MiB unpacked)
Retrieving package jdk-2000:1.7.0_21-fcs.x86_64                           (1/1),  81.4 MiB (149.6 MiB unpacked)
Installing: jdk-2000:1.7.0_21-fcs .......................................................................[done]
Additional rpm output:
Unpacking JAR files...
        rt.jar...
        jsse.jar...
        charsets.jar...
        tools.jar...
        localedata.jar...

dreamcloud-opensuse:~/Downloads # 

3) update alternatives

to make jdk 7 as default jdk

opensuse:/usr/java/jdk1.7.0_21/bin # for bin in *; do update-alternatives --install /usr/bin/$bin $bin $(pwd)/$bin 20000; done

4) verify java and javac version

dreamcloud-opensuse:/ # javac -version
javac 1.7.0_21
dreamcloud-opensuse:/ # java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)