Java - Oracle java on debian wheezy

From Skytech
Revision as of 18:42, 3 October 2013 by Martin (talk | contribs) (Created page with "Category:Linux = Install oracle java on debian wheezy = This has all been blatantly stolen from here: https://d.stavrovski.net/blog/installing-oracle-java7-on-debian-whee...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Install oracle java on debian wheezy

This has all been blatantly stolen from here: https://d.stavrovski.net/blog/installing-oracle-java7-on-debian-wheezy/ Just having it here in case the site goes offline.

Download from oracle

## 64-bit
wget --no-cookies \
--header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" \
"http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz" \
-O /tmp/jdk-7-linux-x64.tar.gz --no-check-certificate

## 32-bit
wget --no-cookies \
--header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" \
"http://download.oracle.com/otn-pub/java/jdk/7u21-b11/jdk-7u21-linux-i586.tar.gz" \
-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

JHome=/opt/java-oracle/jdk1.7.0
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)