In one of my previous articles I've dealt with creating Oracle (Sun) Java 6 packages for your favorite Debian based distro. Since Oracle Java 7 has been out for a while now and it's code has matured to the point of OpenJDK 7 being default in recent Linux distributions, it seems reasonable to upgrade. In this article I'll show you how to create Oracle (Sun) Java JRE and JDK 7 packages using Janusz Dziemidowicz packaging work from Java 7 binary files you have downloaded your self.
Step one - download code
First thing you need to do is to install some debian packageing related packages and download sun-java-6 packaging code using your terminal:
sudo apt-get install dpkg-dev devscripts debhelper unixodbc cd ~ mkdir oracle-java7 cd oracle-java7 wget --no-check-certificate https://github.com/rraptorr/oracle-java7/tarball/master -O - | tar xz cd rraptorr-oracle-java7-* |
Step two - determine target Java 7 version
Next you must determine Java 7 version Debian package code supports using following command:
dpkg-parsechangelog |
dpkg-parsechangelog
will output the last Debian package changelog entry. By reviewing this changelog entry you will find Java version you need to download in the next step. If package code doesn't support latest Java 7 version available for download from Oracle web site you can update package code to support latest version 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 7version 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 version VERSION". If later package fails to build for this new version it means deeper changes to packaging code are necessary and that you should install older version or wait for update by Janusz Dziemidowicz.
Step three - download Java 7 binary packages
Now you can download Java 7 packages from Oracle servers. These are the files you should download and place inside rraptorr-oracle-java7-*
directory:
- jdk-7uVERSION-linux-i586.tar.gz and jdk-7uVERSION-linux-x64.tar.gz from here. Replace
VERSION
with your target Java 7 version. Keep in mind that both i586 and x64 files are necessary to create Debian package for any architecture. - UnlimitedJCEPolicyJDK7.zip from here.
Step four - build Java 7 Debian packages
The last step is to create your target Oracle Java 7 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 .. sudo dpkg -i oracle-java7*.deb |
Since dpkg doesn't resolve dependencies you must use apt-get to install additional required packages:
sudo apt-get install -f |
That's all there is to installing latest Oracle (Sun) Java JRE or JDK 7 on Debian based Linux distribution.