Debian ships with OpenJDK by the default, but the Sun(now Oraclel)JDK have removed from repositories as a result of a new redistribution license recently. So
it is not possible to install Oracle Java SDK from Debian's repo. The following step will tell you how to install Oracle Java SDK without Debian repo manual.
 
My platform
Hardware : Lenovo T420 (CPU I5, DIMM 6GB, SSD 128GB+512GB, NVS4200+intel)
Software : Debian wheezy amd64

This guide assumes 64bit Java7, and the machine has no other version Java.

Download

First you need to download the lastest Java SE SDK version. Go to the following link and download the file jdk-7u25-linux-x64.tar.gz(maybe a later update vaailable)
http://www.oracle.com/technetwork/java/javase/downloads/index.html

Install 
Once download has completed, extract it into the /opt directory(new need root permission). To do this, open a new root terminal and run the below commands:

点击(此处)折叠或打开

  1. # update-alternatives --install /usr/bin/java java /opt/jdk1.7.0_03/bin/java 1
  2. # update-alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_03/bin/javac 1
  3. # update-alternatives --set java /opt/jdk1.7.0_03/bin/java
  4. # update-alternatives --set javac /opt/jdk1.7.0_03/bin/javac
That's it!
Note: Debian already has a pattern for managing different software version on the same system. When you install a software manual, you could configurate the software
for system by the method.

Test

To see which version of Java you are new running by default, execute the following command from a new terminal:
#java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)


09-28 05:24