Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I updated my installation of the sun-java6-jdk package today to version 6.24-1build0.10.10.1 after being prompted by the update manager. However this now causes some compilation failures so I'd like to revert back to the previous version that I had installed.

I've tried using Synaptic but the 'Force Version' menu command is disabled.

I've tried the following command to install the previous version

sudo apt-get install sun-java6-jdk=6.22-0ubuntu1~10.10

But I'm not sure that I have the correct version:

Reading package lists... Done 
Building dependency tree
Reading state information... Done 
E: Version ‘6.22-0ubuntu1~10.10’ for ‘sun-java6-jdk’ was not found

I've taken this version number from this changelog:

Is this the correct way to install a previous version of a package? Have I got the correct version from the sun-java6 change log?

share|improve this question
I usually just do apt-get install sun-java6-jdk. – Thorbjørn Ravn Andersen Feb 23 '11 at 21:27
up vote 4 down vote accepted

It's the correct way to downgrade a package, but you seem to have got the version number wrong....

apt-get install sun-java6-jdk=6.22-0ubuntu1~10.10 - won't work since there is no such package in the Package.gz list, that's why you got the error: Version ‘6.22-0ubuntu1~10.10’ for ‘sun-java6-jdk’ was not found.

Try this... dpkg -r sun-java6-jdk --- Removes the sun-java6-jdk

Download the .deb for your previous sun-java6-jdk version, you may already have this file in /var/cache/apt/archives --- use: $ ls /var/cache/apt/archives/sun* -lash in your terminal to find out whether you have an older version locally.

apt-get install -d sun-java-jdk / openjdk-6-jdk -- the -d will only download the file into your /var/cache/apt/arhives folder.

dpkg -i --force-downgrade /var/cache/apt/archives/sun-java-jdk(the version # that you have).

Lock Version in Synaptic so ubuntu doesn't try to upgrade it again. Dpkg man page will also help explain things -- downgrade has a big warning label on it in the man pages, so take note you don't wreck your dependencies. There is a post here and here that explains downgrading.

share|improve this answer

The way I got the older version of java was different. I used the command $ sudo apt-get install default-jre, so you should use that command as well. No extra repository is needed. If you DO use this command, I suggest removing the previous package you tried using by typing in sudo apt-get remove sun-java6-jdk=6.22-0ubuntu1~10.10. By now, you should have a working previous java version. The default-jre package uses the java version 1.7.0_91. I hope this answer will be of use to you.

share|improve this answer

Your Answer


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.