Installing Java6 JDK on Ubuntu 12.04

UPDATE: [01-May-2012] It appears that this PPA repo is currently broken (does not allow to get GPG key and has unmet dependencies on x84_64). It appears that the install on i386 systems does work anyway if you ignore the GPG key error, but I wouldn’t install in that case as PPA installs are security risk enough without GPG errors.


UPDATE: [11-May-2012] The reason the PPA does not work is that it has been disabled by Ubuntu due to a licensing issue with (not hard to guess) Oracle. Flexion.org have however created a script (hosted on Github) to allow the automated update of Java 6 for those who still require it as a dependency.

wget https://github.com/flexiondotorg/oab-java6/raw/0.2.1/oab-java6.sh -O oab-java6.sh
chmod +x oab-java6.sh
sudo ./oab-java6.sh

Hat tip to Martin Wimpress from Flexion !


UPDATE: [07-Aug-2012] Thanks to a comment from Pierre-Yves Langlois this seems to be the best method (uses the latest version of the Flexion script from Github rather than the version referenced above)

sudo apt-get purge sun-java* #You need to do that if you want the mozilla plugin to work without conflict with java7 for instance.
mkdir ~/src
cd ~/src
git clone https://github.com/flexiondotorg/oab-java6.git
cd ~/src/oab-java6
sudo ./oab-java.sh

Then when its finished, install java:
sudo apt-get install sun-java6-plugin sun-java6-jre sun-java6-bin sun-java6-jdk

You can follow the installation process with:
tail -f ~/src/oab-java6/oab-java.sh.log


Note: If you do not need Java 6 it’s much safer to stick to the current Oracle Java 7 release.


This is an update to the Java6 install on 11.10 since the previous PPA repository has not been updated. To install on Precise Pangolin you need to add the following repository

sudo add-apt-repository ppa:flexiondotorg/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin


EDIT: [01-May-2012] since there seem to be many comments about the repo not working here’s the manual process (since I can’t find any working PPA that is actually maintained).

Download the Linux .bin install (32 or 64bit) from Oracle’s site Java Archive.

#change permissions to allow execute
chmod a+x jdk-6u[current_version_number]-linux-i586.bin
#run the installer file
./jdk-6u[current_version_number]-linux-i586.bin

Note: you obviously need to also maintain the Java6 updated manually.

36 thoughts on “Installing Java6 JDK on Ubuntu 12.04

  1. Its not working

    “Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /tmp/tmp.S76M7P9SkP –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver hkp://keyserver.ubuntu.com:80/ –recv tag:launchpad.net:2008:redacted
    gpg: “tag:launchpad.net:2008:redacted” not a key ID: skipping”

  2. Doesn’t seem to work for me. I get this confusing stuff:

    Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /tmp/tmp.R3lKxmFkgn –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver hkp://keyserver.ubuntu.com:80/ –recv tag:launchpad.net:2008:redacted
    gpg: “tag:launchpad.net:2008:redacted” not a key ID: skipping

  3. $ sudo add-apt-repository ppa:flexiondotorg/java
    [sudo] password for username:
    You are about to add the following PPA to your system:
    tag:launchpad.net:2008:redacted
    More info: https://launchpad.net/~flexiondotorg/+archive/java
    Press [ENTER] to continue or ctrl-c to cancel adding it

    Executing: gpg –ignore-time-conflict –no-options –no-default-keyring –secret-keyring /tmp/tmp.VGrsnITKUy –trustdb-name /etc/apt/trustdb.gpg –keyring /etc/apt/trusted.gpg –primary-keyring /etc/apt/trusted.gpg –keyserver hkp://keyserver.ubuntu.com:80/ –recv tag:launchpad.net:2008:redacted
    gpg: “tag:launchpad.net:2008:redacted” not a key ID: skipping

    Not working :(

  4. Pingback: ubuntu 12 + jdk6 « 檸檬筆記

  5. I get an error after executing this line: sudo ./oab-java6.sh

    during the step: “Downloading jdk-6u33-linux-i586.bin : http://: Invalid host name.”

    Any ideas? I went to the Github project site but did not see any issues listed related to this so it must be something I’m doing wrong.

    Thanks!

  6. I am a near novice in Linux but just used the instructions from the second block above …
    sudo add-apt-repository ppa:flexiondotorg/java ….

    Result is immediate success – brilliant!
    The repositary must now be working again and downloads in my run of Synaptic where the appropriate files (sun-java6-bin, sun-java6-jdk, sun-java6-jre and sun-java6-plugin) are all shown as installed.
    Moreover, it runs the sometimes reluctant ADVFN monitor pages where my attempts with the officially offered java versions failed.

    For all that (and I digress) I find precise an obscure implementation of Ubuntu – it took me 20 minutes to find the Terminal! I much prefer hardy or lucid. They also appear to run a lot smoother/faster – probably more suited to my older machine.

  7. Renaming ‘precise’ to ‘oneiric’ in synaptic allowed me to use the ferramroberto ppa under lubuntu 12.04. While it is probably not the best way but at least it works. And for me it far better than messing with binary installers.

  8. during the step: “Downloading jdk-6u33-linux-i586.bin : http://: Invalid host name.”

    anybody have the idea?

  9. modified oab-java6.sh at line 268 and following, forcing version 6 update 32, in this way:

    # Determine the currently supported Java version and update
    #JAVA_VER=`echo ${DEB_VERSION} | cut -d’.’ -f1`
    JAVA_VER=”6″
    #JAVA_UPD=`echo ${DEB_VERSION} | cut -d’.’ -f2 | cut -d’-‘ -f1`
    JAVA_UPD=”32″

    this solved problem with “Downloading jdk-6u33-linux-i586.bin : http://: Invalid host name.”

    but download page needs authentication and package will not be downloaded via script.
    I’m trying to download package via normal browser and putting it into correct folder via scp.

  10. I have successfully installed java6 with Flexion github script without the error “http:// invalid hostname”. Here is what I did:

    sudo apt-get purge sun-java* #You need to do that if you want the mozilla plugin to work without conflict with java7 for instance.
    mkdir ~/src
    cd ~/src
    git clone https://github.com/flexiondotorg/oab-java6.git
    cd ~/src/oab-java6
    sudo ./oab-java.sh

    Then when its finished, install java:
    sudo apt-get install sun-java6-plugin sun-java6-jre sun-java6-bin

    You can follow the installation process with:
    tail -f ~/src/oab-java6/oab-java.sh.log

    After that, when I do a “java -version” from the console, I get this
    java version “1.6.0_30”
    Java(TM) SE Runtime Environment (build 1.6.0_30-b12)
    Java HotSpot(TM) 64-Bit Server VM (build 20.5-b03, mixed mode)

    And visit the java test site to test the plugin: http://www.java.com/fr/download/testjava.jsp

    Pierre-Yves

  11. Hi

    Thank you for the solution.
    If I’m not mistaken the provided apt-get line in the final solution only install the JRE and not the JDK. I think that the correct install line should look like this:
    sudo apt-get install sun-java6-jdk

    SUF

  12. Looks like a new version got pushed out and the script doesn’t properly support it. Script only works upto 6u33 but 6u34 is out now and script tries to download it but can’t.

  13. Currently on vers 6u35 you can replace in the script

    # wget http://www.oracle.com/${DOWNLOAD_INDEX} -O /tmp/oab-download.html >> "$log" 2>&1 &
    wget http://www.oracle.com/technetwork/java/javase/downloads/jdk6u35-downloads-1836443.html -O /tmp/oab-download.html >> "$log" 2>&1 &

  14. Pierre-Yves solution worked like a charm just yesterday.

    Nevertheless I wanted to share some advice. Please be sure to clean (or just wipe) the content of /var/local/oab before yo (re)start. In our case we ended in a very strange situation in which at least one of the .bin files from Oracle’s site was marked as downloaded successfully, but found appended to itself. We guess it has to do with “wget arguments”, but we could not investigate further at this time. From there, the build phase failed.

  15. why do you recommend installing

    sun-java6-bin sun-java6-jdk

    those aren’t listed in flexion instructions

    The _only_ reason I’m installing sun6 is for brother’s lametard Spawnscape / runescape

  16. @windows refugee on mint; The only reason for the sun-java6-jdk is that I generally need the JDK for my work. Should not be needed just for the runtime.

  17. Pingback: Install Sun JDK6 in Ubuntu 12.04 x64 | Zane 的分享空間

  18. Pingback: ubuntuserver12.04安装rails和db210.1express-c的辛苦历程 - 数据库 - 开发者

  19. Pingback: Apache Hadoop Installation | nitefrog.com

  20. Pingback: admin

  21. Pingback: Mohammad

  22. Pingback: Mohammad

  23. Pingback: stackbot

Leave a Reply

Your email address will not be published. Required fields are marked *