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
share|improve this question
1  
Java 1.5 is too old. Try sudo apt-get install openjdk-7-jdk. – user68186 Sep 10 '14 at 19:52
3  
I need to javajdk 1.5 to run a specific application @user68186 – Tummala Dhanvi Sep 11 '14 at 10:49

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
share|improve this answer
1  
This is what I am searching for tq for ur answer I will accept as soon as I get it done without getting any errors :) – Tummala Dhanvi Sep 11 '14 at 19:46
    
@dhanvi If you will have some problem ask me here – Anton Dozortsev Sep 11 '14 at 19:50
1  
I would suggest you put it in /opt rather than /usr. See askubuntu.com/questions/34880/… – user68186 Sep 11 '14 at 19:54
2  
/usr/lib is where package-managed software goes. These get installed by Ubuntu Sotware Center, apt-get or dpkg. It is best not to put stuff there manually. – user68186 Sep 11 '14 at 20:02
1  
Seconding user68186. Software outside of package management should go into /usr/local or /opt. – muru Sep 11 '14 at 20:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.