I am using Ubuntu version 12.04 (via VM)

I downloaded and installed java:

sudo apt-get install python-software-properties
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

The version is:

java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

But I need the version:

java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.13) (6b20-1.9.13-0ubuntu1~10.04.1)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)

How can I download and install sun-java6-jdk version 1.6.0_20?
Thanks in advance

migrated from stackoverflow.com Oct 5 '12 at 3:54

This question came from our site for professional and enthusiast programmers.

For installing the particular version of sun java run:

sudo apt-get install sun-java6-jdk=1.6.0_20

Then to choose the default java installation run the following and choose the correct installation:

sudo update-alternatives --config java
  • I get this: Reading package lists... Done Building dependency tree Reading state information... Done E: Version '1.6.0_20' for 'sun-java6-jdk' was not found – Bla bla Oct 4 '12 at 17:04
  • It appears the sun java packages are not present in the ubuntu repos anymore. Follow the instructions here to get and install them from alternative locations. – Abhinav Sarkar Oct 4 '12 at 17:11

Try:

sudo update-alternatives --config java

Source: Ubuntu Community Wiki.

  • I get this: There is only one alternative in link group java: /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java Nothing to configure. – Bla bla Oct 4 '12 at 17:03

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.