Install Sun Java 6 JRE and JDK from .deb packages

So, Canonical disabled my Java PPA at the end of last week. So I’ve developed another solution for installing Java 6u30 on Ubuntu which doesn’t infringe any copyrights, licenses, terms of use or CoC’s. However, by running this script to download Java you acknowledge that you have read and accepted the terms of the Oracle end user license agreement.

My script is an automated wrapper for Janusz Dziemidowicz Debian packaging scripts for Java 6. My new script simply downloads the Java binary installers from Oracle, builds the .deb packages locally on your computer and creates a local ‘apt’ repository for them. Once my script has been executed you can then ‘apt-get’ install/upgrade Java 6 from your local repository. Packages are compatible with “official” Ubuntu ones and pre-existing Java 6 packages will upgrade cleanly.

You can find the script and full usage instructions on github.

The quick and dirty guide for using this script is as follows:

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

Please read the README file for a more detailed explanation of how the script works and how to use it. If anyone has any problems, then please submit a ticket on my Issue Tracker.

Posted on January 16, 2012 at 1:20 pm by Martin · Permalink
In: Linux · Tagged with: , , , , , , ,

39 Responses

Subscribe to comments via RSS

  1. Written by S. Schneider
    on January 16, 2012 at 5:57 pm
    Reply · Permalink

    Thanks!
    It worked, but had some dependency problems…
    I think it is related to “unixobdc dev”, not sure…
    I checked the log and installed with synaptic

  2. Written by S. Schneider
    on January 16, 2012 at 6:01 pm
    Reply · Permalink

    I tried once again, no more dependency errors, but no ia32deb…?
    This is the latest terminal output:
    ====================================
    sps@Kub64:~$ sudo ./oab-java6.sh -k jre
    oab-java6.sh v0.1.1 – Install Java 6u30 from locally built packages.
    Copyright (c) 2012 Flexion.Org, http://flexion.org. MIT License

    By running this script to download and/or install Java you acknowledge that
    you have read and accepted the terms of the Oracle end user license agreement.

    http://www.oracle.com/technetwork/java/javase/terms/license/

    If you want to see what this is script is doing while it is running then execute
    the following from another shell:

    tail -f /home/spsoab-java6.sh.log

    Here we go…
    [x] Installing development tools success
    [x] Making build directories success
    [x] Removing clones of https://github.com/rraptorr/sun-java6 success
    [x] Cloning https://github.com/rraptorr/sun-java6 success
    [x] Downloading jdk-6u30-linux-i586.bin : ~80MB success
    [x] Symlinking jdk-6u30-linux-i586.bin success
    [x] Downloading jdk-6u30-linux-x64.bin : ~80MB success
    [x] Symlinking jdk-6u30-linux-x64.bin success
    [x] Updating the changelog success
    [x] Building the packages \Error: “/var/tmp/kdecache-sps” is owned by uid 1000 instead of uid 0.
    success
    [x] Moving the packages success
    [x] Installing Java 6u30 : [jre] success
    All done!
    sps@Kub64:~$ kbuildsycoca4 running…
    Error: “/var/tmp/kdecache-sps” is owned by uid 1000 instead of uid 0.
    kbuildsycoca4(7323) KConfigGroup::readXdgListEntry: List entry text/html in “/home/sps/.local/share/applications/mimeapps.list” is not compliant with XDG standard (missing trailing semicolon).
    ====================================

  3. Written by S. Schneider
    on January 16, 2012 at 6:03 pm
    Reply · Permalink

    Forgot to mention, this is a oneiric kubuntu64 box
    Thanks for your work!

  4. Written by dakira
    on January 16, 2012 at 10:58 pm
    Reply · Permalink

    The build won’t be successful if unixobdc is not installed. I tried this on a vanilla (freshly installed) 32bit Ubuntu.

  5. Written by Jim
    on January 17, 2012 at 1:10 am
    Reply · Permalink

    Would love to get this working, where do I submit errors for troubleshooting?

    I get the following errors on my x64 build:

    [x] Updating the changelog success
    [x] Building the packages success
    [x] Moving the packages failed
    [i] Showing the last 5 lines from the logfile (/home/user/Downloads/java/oab-java6.sh.log)…
    success
    [x] Moving the packages mv: cannot stat `/var/local/oab/sun-java6-*_6.30-3~oneiric1_*.deb’: No such file or directory
    mv: cannot stat `/var/local/oab/sun-java6_6.30-3~oneiric1_amd64.changes’: No such file or directory

  6. Written by webmaster
    on January 17, 2012 at 12:23 pm
    Reply · Permalink

    Thanks for all your feedback. I’ll set up a bare bones test system and double check the build and install requirements. Hopefully I’ll have an updated script later today.

  7. Written by webmaster
    on January 17, 2012 at 5:01 pm
    Reply · Permalink

    Thanks to the issues reported above I’ve taken the script in a new direction. 0.1.3 is now available, please take the time to read the full README.

    https://github.com/flexiondotorg/oab-java6

    The script no longer directly installs any Java packages, instead it now creates a locally hosted ‘apt’ repository for the Java 6 packages it created. You are now able to ‘apt-get’ install/upgrade Java 6 in the normal way, except the packages are sourced from your own file system. This approach solves the dependency issues reported and is much cleaner solution. I wish I’d done this form the outset :-)

    If anyone has any problem, then please submit a ticket on my Issue Tracker.

    https://github.com/flexiondotorg/oab-java6/issues

  8. Written by TechNerdCentral
    on January 19, 2012 at 1:46 am
    Reply · Permalink

    What exactly the difference between doing it the above way or from the PPA????

    sudo add-apt-repository ppa:sun-java-community-team/sun-java6
    sudo apt-get update
    sudo apt-get install sun-java6-jre sun-java6-plugin equivs

    I’m confused… Is there a difference between either of these methods? I would love to have some feedback either way about which is the best method to install Java. I prefer using the PPAs when I can to install software on Ubuntu, but if you have a good reason for what it is better to use the script, I would like to hear anyone’s opinions either way.

  9. Written by Paul
    on January 19, 2012 at 3:41 am
    Reply · Permalink

    If I install Java 6 using your script, will my Java installation automatically update when Oracle publishes security updates?

  10. Written by Giovanni Escobar
    on January 20, 2012 at 2:38 am
    Reply · Permalink

    Quite a job. Thanks a lot. Just one question from a newbie: after seeing your script, and expecting Oracle to decide we should click somewhere to download their files, why don’t you ask us to do it previously executing your script?

    And I understand that Janusz Debian Packaging scripts are thought to make a HOLE ppa of java packages. Is that why we need to download both (rather big) java*.bin? How difficult would it be to make a more focused script? I just wanted the JRE for 64b and plugin, not the JDK.

    By the way, there was no problem with the script. However, during the second download the speed was far worst than during the first one, and it was not my ISP, it was Oracle servers (or something from that side).

    Also, when I ran
    $sudo apt-get upgrade
    there was a warning that the packages couldn’t be authenticated (sorry if is not the right translation, my system is in Spanish), of course because it is a LOCAL ppa, not a remote one. But for a newbie, it is a little chocking…

    Thanks a lot. Now my system is how I need it.

  11. Written by Martin
    on January 20, 2012 at 10:24 am
    Reply · Permalink

    Hi,

    @TechNerdCentral – All the Java 6 packages in the PPA’s or Canonical repositories are version 6u26 or older. The version have security vulnerabilities that are being exploited in the wild. If you have install Java 6 from the Canonical repositories then the Java 6 browser plugin has been removed in a recent package update.

    @Paul – 0.1.3 of my script will only create version 6u30 packages. However, I will soon be releasing an update which automatically tracks the upstream Debian packaging script which will provide a means of getting that latest Java 6 update.

    @Giovanni – You should ask Janusz about the requirement for both Java6 installers, since my script rely on his entirely – https://github.com/rraptorr/sun-java6/issues Yes, the Oracle download servers can be horribly slow, which is why my script caches the downloads, so that you only need download them once each :-) Yes, the local ‘apt’ repository is unsigned. I’m not sure if I will be able to address that. I’ll update the documentation though.

    Thanks to all of you for the feedback.

    Regards, Martin.

  12. Written by Martin
    on January 20, 2012 at 6:19 pm
    Reply · Permalink

    Hi,

    @Giovanni – I’ve update the script to 0.1.4. This new version now signs the local ‘apt’ repository which means the packages are authenticated :-)

    Regards, Martin.

  13. Written by seb
    on January 20, 2012 at 8:00 pm
    Reply · Permalink

    Hi,
    Getting an error with apt-get, something prevents the package from being create, any ideas where to look? I added an error from the oab script, but I am not sure what could cause it.

    $ sudo apt-get install sun-java6-jre
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package sun-java6-jre 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

    E: Package ‘sun-java6-jre’ has no installation candidate

    – output from the script:

    [x] Symlinking jdk-6u30-linux-x64.bin success
    dpkg-deb: error: failed to read archive `/var/local/oab/deb/*.deb’: No such file or directory
    dpkg-deb: error: failed to read archive `/var/local/oab/deb/*.deb’: No such file or directory
    [x] Creating Packages.gz file success

    • Written by Martin
      on January 20, 2012 at 9:47 pm
      Reply · Permalink

      I just released 0.1.5, it should fix the problem :-)

  14. Written by Bob
    on January 20, 2012 at 9:10 pm
    Reply · Permalink

    Hi Martin,

    Great idea and script! But it didn’t work without a small correction.

    Seems to me you left some comment hashes in the sections “[x] Building the packages” and “[x] Moving the packages”.

    I removed them and the script works flawless :)

  15. Written by Teg
    on January 20, 2012 at 11:27 pm
    Reply · Permalink

    Have you thought about adding an additional script to support Oracle’s Java 7? It would be awesome to have both as an option. :-)

    • Written by Martin
      on January 20, 2012 at 11:30 pm
      Reply · Permalink

      Take a look at the TODO section in the README :-)

  16. Written by Teg
    on January 21, 2012 at 4:59 am
    Reply · Permalink

    I use your Shotwell PPA for my Lucid box and from looking at the source code for this, your work is really top of the line and I can be confident in recommending your packages to others.

  17. Written by dowel
    on January 21, 2012 at 8:19 am
    Reply · Permalink

    Thank you very much for your work: Works like charm on Ubuntu Server 10.04 LTS and keeps my Etherpad Server up to date!

  18. Written by peter
    on January 22, 2012 at 1:27 am
    Reply · Permalink

    I am running Ubuntu 11.10/Chrome.

    Thank you for doing all this work! My issue is that when I went to the java website to see if I had the plug-in installed, it said that I don’t, but, in Ubunto software,it shows that openjdk-6-jre 6b23~pre11-0ubuntu1.11.10 IS INSTALLED. Should I install icedtea-plugin 1.1.3-1ubuntu1.1

    The reason why I am concerned about this is that I wasn’t able to get a job interview (virtual/camera).

    Here are the specs that were given on the job interviewer’s website, but there is no info on Ubuntu, so maybe that is THE problem (as I don’t have any of those 3 OS). Can you help me find out if a) JAVA is installed properly and b) if the interview did not work because I did not have the JAVA plug-in working.

    A PC or MAC computer
    PC : Windows 2000, XP 32-bit (SP3), 2003, Vista 32-bit/64-bit – Internet Explorer 6/7/8/9 (Win 7) – Firefox 3.x, 4 (32 bit) – Chrome 9,10 – JavaScript et cookies actives – Sun Java 5 ou plus – Activer ActiveX pour Internet Explorer – processeur Intel AMD (1GHz ou plus) – Au minimum 512 MB RAM (au minimum 2 GB RAM pour Vista) – Netbooks Windows XP
    Mac OS X 10.5, 10.6 Safari 4/5 – Firefox 3.x,4 – Chrome 9,10 – JavaScript et cookies actives – Apple Java 5 ou plus – Pas de support pour ‘accès distant’ – processeur Intel – au minimum 512 MB RAM
    Solaris 10/1 Mozilla 1.7 – Firefox 3x – JavaScript et cookies actives – Sun Java 5 ou plus – pas de support pour ‘accès distant’ – SPARC ou Intel ou AMD processeur (Solaris 10) – Processeur Intel ou AMD (Solaris 11) – au minimum 1 GB RAM
    HP-UX 11.11 Mozilla 1.7 – Fireforx2 – JavaScript et cookies actives – Sun Java 5 ou plus – Processeur PA-RISC

  19. Written by peter
    on January 22, 2012 at 1:31 am
    Reply · Permalink

    Oops! Just noticed that the English version of the website doesn’t have that part translated in English (http://www.linguapassion.com/cgv.php?lang=en&PHPSESSID=9dc922b58caa11068034929f1ecfe17b). Strange! Hopefully, you can make sense of the French, because there is a lot of English there! :)

  20. Written by zeis
    on January 22, 2012 at 3:30 am
    Reply · Permalink

    Please, someone has worked in Linuxmint Lisa, installed 1.6.0.26. 1.6.0.30 not detected, or forcing synaptic release

  21. Written by sucotronic
    on January 24, 2012 at 8:42 am
    Reply · Permalink

    One suggestion, is not very network efficient to download 32 and 64 bits installer if the system where the script is running only is of one kind. You can put something like ‘file /bin/ls’ and it’ll output ‘/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped’ for a 32 bit system, and different thing for a 64 bit system.

  22. Written by Rob Parker
    on January 28, 2012 at 2:51 pm
    Reply · Permalink

    Thanks for the great work! I’m already on 12.04 (64bit) and sadly the script seems to fail on it at the moment (at or before the ‘Moving Packages’ stage), but running the script on a 11.10 virtual machine and copying the packages over works fine.

  23. Written by anocoder
    on January 28, 2012 at 9:57 pm
    Reply · Permalink

    You, sir, win a thousand internets! Thank you for this wonderful script, it saved me and hopefully many others a lot of grunt work, and allows us to use the time to create free software instead.

  24. Written by Fred
    on January 31, 2012 at 9:26 pm
    Reply · Permalink

    Hi !
    This scripts looks interesting, but I have an error when it builts the packages :

    [x] Creating Packages.gz file success
    [x] Creating Release file success
    [x] Create GnuPG configuration success
    Stopping Hardware RNG entropy gatherer daemon: (not running).
    [x] Start generating entropy 29990′s retcode: 0
    success
    [x] Creating signing key gpg: keyring `/var/local/oab/gpg/secring.gpg’ created
    gpg: keyring `/var/local/oab/gpg/pubring.gpg’ created
    gpg: /var/local/oab/gpg-key.conf:5: missing argument 30000′s retcode: 2
    failed

    I did not actually more than this about where this error is from. Any clue ?

  25. Written by roadtest
    on January 31, 2012 at 10:06 pm
    Reply · Permalink

    Thanks a lot for this excellent work! It saves me lots of time to update jdk on 30 client servers.

  26. Written by Ian
    on February 12, 2012 at 8:30 pm
    Reply · Permalink

    Another problem:

    Downloading common.sh
    [x] Installing Java build requirements success
    [x] Making build directories success
    [x] Removing clones of https://github.com/rraptorr/sun-java6 success
    [x] Cloning https://github.com/rraptorr/sun-java6 success
    [x] Checking out v6.30-3 success
    [x] Downloading jdk-6u30-linux-i586.bin : ~80MB success
    [x] Symlinking jdk-6u30-linux-i586.bin success
    [x] Downloading jdk-6u30-linux-x64.bin : ~80MB success
    [x] Symlinking jdk-6u30-linux-x64.bin success
    [x] Updating the changelog success
    [x] Building the packages success
    [x] Moving the packages failed
    [i] Showing the last 5 lines from the logfile (/home/ian/oab-java6.sh.log)…
    success
    [x] Moving the packages mv: cannot stat `/var/local/oab/sun-java6_6.30-4~oneiric1_i386.changes’: No such file or directory
    mv: cannot stat `/var/local/oab/*sun-java6-*_6.30-4~oneiric1_*.deb’: No such file or directory
    16842′s retcode: 1
    failed

    One thing that’s missing is an undo for when it goes worng – what needs deleting to try again?

  27. Written by Ian
    on February 12, 2012 at 8:50 pm
    Reply · Permalink

    Ah, it’s looking like the file system came close to filling up. The fact that it downloaded both the i386 and x64 versions didn’t help – is there a reason for this?

  28. Written by zeis
    on February 13, 2012 at 11:37 pm
    Reply · Permalink

    java-common is installed?

  29. Written by zeis
    on February 16, 2012 at 9:34 pm
    Reply · Permalink

    # Damn it, if it weren’t for having to know the release number this could be
    # entirely dynamic!
    JAVA_REL=”b04″

    jdk6u31

  30. Written by cyrinda
    on February 21, 2012 at 10:25 am
    Reply · Permalink

    hi, still ends with error about non-existing file or folder:

    [x] Moving the packages failed
    [i] Showing the last 5 lines from the logfile (/home/cyrinda/oab-java6.sh.log)…
    success
    [x] Moving the packages mv: nelze získat informace o „/var/local/oab/sun-java6_6.31-1~oneiric1_i386.changes“: Adresář nebo soubor neexistuje
    mv: nelze získat informace o „/var/local/oab/*sun-java6-*_6.31-1~oneiric1_*.deb“: Adresář nebo soubor neexistuje
    4498′s retcode: 1
    failed

    unixodbc and java-common are installed
    what can i do more?

  31. Written by nutznboltz
    on February 21, 2012 at 6:55 pm
    Reply · Permalink

    @cyrinda please run this command and copy-paste the output back to me, thank you.

    lsb_release -a

  32. Written by cyrinda
    on February 22, 2012 at 7:58 am
    Reply · Permalink

    Hi & Thx for reply, here it is, it is a clean&fresh (yesterdays) installation:
    LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch
    Distributor ID: Ubuntu
    Description: Ubuntu 11.10
    Release: 11.10
    Codename: oneiric

  33. Written by nutznboltz
    on February 22, 2012 at 3:25 pm
    Reply · Permalink

    @cyrinda Your system may have run out of free disk space during the installation procedure.

    Can you copy-paste back the output of:

    df -h -x tmpfs -x devtmpfs -x debugfs

    Thanks

  34. Written by cyrinda
    on February 22, 2012 at 7:19 pm
    Reply · Permalink

    I think no – on my system partition is more than 50Gb free and output is:

    /dev/sda3 56G 4,1G 50G 8% /
    /dev/sda5 325G 86G 223G 28% /home

    thank you for reply and I hope that my response will be usefull

  35. Written by nutznboltz
    on February 22, 2012 at 8:22 pm
    Reply · Permalink

    I am thinking that the mv command might be having issues with whitespace that only occur when certain locales are used, one of them being Czech.

    Can you please try:

    LANG=en_US.UTF-8 sudo -E ./oab-java6.sh

    and see if it still has an issue with the mv command?

  36. Written by nutznboltz
    on February 22, 2012 at 8:23 pm
    Reply · Permalink

    or maybe

    LANG=C sudo -E ./oab-java6.sh

Subscribe to comments via RSS

Leave a Reply