Monday, August 20, 2007

Linux: Installing sun-java 6u2 the Debian way on Ubuntu Dapper

Even though the recent changes in Sun's licensing, for distributing the jdk as a package, allows Ubuntu to provide prepackaged jdk's, I couldn't find a package for my Dapper install. On the dutch Ubuntu forums there was someone asking for a package for jdk 6u2, so I decided to give him a hand. This is the procedure that will work on Dapper, Edgy and Feisty:
  1. sudo apt-get install java-package

  2. now edit: gksudo gedit /usr/share/java-package/sun-j2sdk.sh

  3. search this section:

    "jdk-1_5_0_"[0-9][0-9]"-linux-i586.bin") # SUPPORTED
    j2se_version=1.5.0+update${archive_name:10:2}
    j2se_expected_min_size=130
    found=true
    ;;
    esac
    ;;

  4. make it look like this:

    "jdk-1_5_0_"[0-9][0-9]"-linux-i586.bin") # SUPPORTED
    j2se_version=1.5.0+update${archive_name:10:2}
    j2se_expected_min_size=130
    found=true
    ;;
    "jdk-6u"[0-9]"-linux-i586.bin") # SUPPORTED
    j2se_version=1.6.0+update${archive_name:6:1}
    j2se_expected_min_size=58
    found=true
    ;;
    esac
    ;;

  5. copy: sudo cp -r /usr/share/java-package/sun-j2sdk1.5 /usr/share/java-package/sun-j2sdk1.6

  6. edit: gksudo gedit /usr/share/java-package/sun-j2sdk1.6/install and replace j2sdk1.5-sun by j2sdk1.6-sun

  7. edit: gksudo gedit /usr/share/java-package/sun-j2sdk1.6/remove and replace j2sdk1.5-sun by j2sdk1.6-sun

  8. download: jdk-6u2-linux-i586.bin

  9. execute install: fakeroot make-jpkg ./jdk-6u2-linux-i586.bin

  10. this results in a .deb that you can install using sudo dpkg -i ./sun-j2sdk1.6_1.6.0+update2_i386.deb


Voila.

7 comments:

mrsulu said...

Ah ha, mister Kenneth , meneer heeft een tweeling nu ;-)

Tot ziens,
Herman (vanuit AXA)

kennywest said...

Herman! Kerel, alles goed met u. Zo te zien nog steeds aan het werk bij Axa. Ondertussen heb ik ook Delaware geruild voor een interessantere job ;)
De tweeling wordt maandag (27/08) geboren, dus dat wordt nog even afwachten.
Tot ziens.

Florian said...

Thanks a lot for this post, it sweetened my morning :-)

Anonymous said...

Great, thank you :) !

René said...

Don't forget to check wich version of java is used by default after using this super recipe bij entering the command:

sudo update-alternatives --config java

and choose the new version as default...

Thanks for posting!

Anonymous said...

Thanks for the post! It was incredibly helpful!

Anonymous said...

Thanks from Rina.
Paris