5

I am getting this error when trying to install java 1.5 JDK

sudo apt-get install sun-java5-jdk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package sun-java5-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  apt:i386 apt

E: Package 'sun-java5-jdk' has no installation candidate
Kulfy
  • 17,696
Tummala Dhanvi
  • 1,821
  • 3
  • 21
  • 34

1 Answers1

9

Download JDK 5

Create directory for JDK:

sudo mkdir /usr/lib/jvm/java5

Extract archive in a new folder:

sudo tar xf java5.tar.gz -C /usr/lib/jvm/java5

Now run:

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java5/jdk1.5.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java5/jdk1.5.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/java5/jdk1.5.0/bin/javaws" 1

Correct the file ownership and the permissions of the executables:

sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/java5/jdk1.5.0

Check if it successful:

java -version
Anton Dozortsev
  • 1,132
  • 10
  • 21