How to install an older version of Java

28,400

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:
28,400

Related videos on Youtube

user722905
Author by

user722905

Updated on September 17, 2022

Comments

  • user722905
    user722905 over 1 year

    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: https://launchpad.net/ubuntu/+source/sun-java6/+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?