Debian Oracle Java 7 Installation Guide

Reference JavaPackage

Process

  1. Add a "contrib" component to /etc/apt/sources.list
    more /etc/apt/sources.list
    deb http://mirror.cs.nchu.edu.tw/debian/ wheezy main contrib
    deb http://mirror.cs.nchu.edu.tw/debian/ jessie main contrib
  2. Update the list of available packages and install the java-package package:
    sudo aptitude update
    sudo aptitude safe-upgrade
    sudo aptitude install java-package
  3. Download the desired Java JDK/JRE binary distribution (Oracle). Choose tar.gz archives or self-extracting archives, do not choose the RPM!
  4. Use java-package to create a Debian package, for example:
    make-jpkg jdk-7u*-linux-x64.tar.gz
  5. Install the binary package created:
    sudo dpkg -i oracle-java7-jdk_7u*_amd64.deb

Configuration

sudo update-alternatives --auto java
export JAVA_HOME=`readlink -f /usr/bin/java | sed "s:bin/java::"`

Write in the /etc/profile, if it does not work for tomcat, Add to /etc/default/tomcat6

JAVA_HOME=JAVA_HOME=/usr/lib/jvm/jdk-7-oracle-x64
JRE_HOME=/usr/lib/jvm/jdk-7-oracle-x64/jre
export JAVA_HOME JRE_HOME