Install Oracle (Sun) Java 6 on Debian, Ubuntu and LinuxMint revised

Java Logo I've already wrote about installing latest Oracle (Sun) Java JDK and JRE 6 on Ubuntu based operating systems. In that article I wrote about BASH script used to download Oracle Java packages from Oracle servers and to create Debian packages. Unfortunately this script often fails due to Oracle web site changes and then you're supposed to wait for script developer to update his work or update it your self. In this article I'll show you how to create Oracle (Sun) Java 6 packages from Java 6 binary files you have downloaded your self. This procedure is using Janusz Dziemidowicz packaging work without any helper BASH scripts.

Step one - download code

First thing you need to do is to install some packages and download sun-java6 Debian package code:

sudo apt-get install dpkg-dev devscripts debhelper unixodbc
cd ~
mkdir sun-java6
cd sun-java6
wget --no-check-certificate https://github.com/rraptorr/sun-java6/tarball/master -O - | tar xz
cd rraptorr-sun-java6-*

You should leave this console window open, you will need it in the next step.

Step two - target Java 6 version

Next you must determine Java 6 version Debian package code supports using this command from your console window left open in the previous step:

dpkg-parsechangelog

dpkg-parsechangelog will output the last Debian package changelog entry. By reviewing this changelog entry you will find Java 6 version you need to download in the next step. If package code doesn't support latest Java 6 version available for download you can update package code to support it your self. Usually this includes only adding new entry into Debian changelog using dch utility:

dch -v VERSION-1

You should replace VERSION with the latest Java 6 version available for download. This command will open your text editor where you will be able to describe Debian package change in details. It makes sense to describe this entry with something like "Adding support for Oracle Java 6 version VERSION". If later package fails to build for this new version it means deeper changes are necessary.

Step three - Java 6 binary packages

Now you can download Java 6 packages from Oracle servers. These are the files you should download and place inside rraptor-sun-java6 directory:

  • jdk-6uVERSION-linux-i586.bin and jdk-6uVERSION-linux-x64.bin from here. Replace VERSION with your target Java version. Keep in mind that both i586 and x64 files are necessary to create Debian package.
  • jce_policy-6.zip from here.

Step four - build Java 6 Debian packages

The last step is to create your target Oracle Java 6 Debian package:

dpkg-buildpackage -uc -us

This command might fail at first because depending on your architecture you will need to install a few additional packages as instructed by this command output. When you install all packages this command will create few .deb files you can install using something like this:

cd ..
dpkg -i sun-java6*.deb

Since dpkg doesn't resolve dependencies you must use apt-get to install additional required packages:

sudo apt-get install -f

Good luck!

DevGenii

A quality focused Magento specialized web development agency. Get in touch!

Leave a Reply

Your email address will not be published. Required fields are marked *