Skip to content

Instantly share code, notes, and snippets.

@i-blis
Last active August 29, 2015 14:01
Show Gist options
  • Save i-blis/909381e0c289f7a00a98 to your computer and use it in GitHub Desktop.
Save i-blis/909381e0c289f7a00a98 to your computer and use it in GitHub Desktop.
Install Oracle Java on Debian

Install Oracle Java on Debian

Download

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u25-b17/jdk-8u25-linux-x64.tar.gz

Install

mkdir /opt/jdk
tar -zxf jdk-8u5-linux-x64.tar.gz -C /opt/jdk

Set up

update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_25/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_25/bin/javac 100

New versions are installed and set up in the same manner, with a higher priority number. Old versions may safely be removed:

update-alternatives --remove java /opt/jdk/jdk1.8.0_25/bin/java
update-alternatives --remove javac /opt/jdk/jdk1.8.0_25/bin/javac

rm -rf /opt/jdk/jdk1.8.0_25

We can view the linked java and choose between multiple java installs with update-alternatives --display java and update-alternatives --config java

Install Oracle Java on Debian

Download

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.tar.gz

Make package

We need to be non-root and use fakeroot in order to run make-jpkg.

fakeroot make-jpkg jdk-7u55-linux-x64.tar.gz

Install

dpkg -i oracle-j2sdk1.7_1.7.0+update55_amd64.deb

We can view the linked java and choose between multiple java installs with update-alternatives --display java and update-alternatives --config java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment