Java - Oracle java on debian wheezy

From Skytech
Jump to: navigation, search

Install oracle java on debian wheezy

This has all been blatantly stolen from here: Just having it here in case the site goes offline.

Download from oracle

## 64-bit
wget --no-cookies \
--header "Cookie:" \
"" \
-O /tmp/jdk-7-linux-x64.tar.gz --no-check-certificate

## 32-bit
wget --no-cookies \
--header "Cookie:" \
"" \
-O /tmp/jdk-7u21-linux-i586.tar.gz --no-check-certificate

Unpack and install

mkdir /opt/java-oracle

## 64-bit
tar -zxf /tmp/jdk-7-linux-x64.tar.gz -C /opt/java-oracle

## 32-bit
tar -zxf /tmp/jdk-7u21-linux-i586.tar.gz -C /opt/java-oracle

Use debian update-alternatives to point at the correct path/files

update-alternatives --install /usr/bin/java java ${JHome%*/}/bin/java 20000
update-alternatives --install /usr/bin/javac javac ${JHome%*/}/bin/javac 20000

## Use newly installed version
update-alternatives --config java

>There are 2 choices for the alternative java (providing /usr/bin/java).
>  Selection    Path                                            Priority   Status
>* 0            /opt/java-oracle/jdk1.7.0/bin/java               20000     auto mode
>  1            /opt/java-oracle/jdk1.7.0/bin/java               20000     manual mode
>  2            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual

Verify version

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)