There can be a need to install JDK5 on Ubuntu16.04 to run some legacy applications. apt-get will install the most recent version of JDK available in the repository which might not be good for the old applications. I was trying to install an old application on UBUNTU server but for that an old version of JDK was required. How to install HDJ5 on Ubuntu16.04, I followed the steps given in this post. This is done in Ubuntu 16.04 and Hopefully it should work for Ubuntu 10.04+.
These are the steps for Ubuntu 16.04.
Download JDK5 (jdk-1_5_0_22-linux-amd64-rpm.bin) from the oracle site.
Run the following commands in the given order.
chmod a+x jdk-1_5_0_22-linux-amd64-rpm.bin
apt install alien
dpkg -i jdk_1.5.022-1_amd64.deb
If you use rpm to install the .rpm, you will get following error.
rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing…
error: Failed dependencies:
glibc >= 2.1.2-11 is needed by jdk-2000:1.5.0_22-fcs.i586
sh-utils >= 2.0-1 is needed by jdk-2000:1.5.0_22-fcs.i586
fileutils >= 4.0-8 is needed by jdk-2000:1.5.0_22-fcs.i586
gawk >= 3.0.4-1 is needed by jdk-2000:1.5.0_22-fcs.i586
textutils >= 2.0-2 is needed by jdk-2000:1.5.0_22-fcs.i586
So I used alien and dpkg to handle it with usual package installing in java. Hope this will help to somebody who is trying to work with java 1.5 in Ubuntu 16.04.
dpkg – package manager for Debian
dpkg is a tool to install, build, remove and manage Debian packages. The primary and more user-friendly front-end for dpkg is aptitude(1). dpkg itself is controlled entirely via command line parameters, which consist of exactly one action and zero or more options. The action-parameter tells dpkg what to do and options control the behavior of the action in some way.
dpkg can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The list of supported actions can be found later on in the ACTIONS section. If any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the parameters given to it, but no specific options are currently passed to them, to use any such option the back-ends nee to be called directly.