A bit of context

Duke, Java's mascot

You may remember the first advertisings for the Java language; for me, it was undeniablely linked to the applets, these small applications that I used to be able to run in my NCSA Mosaic browser (or in HotJava) (especially Duke doing some funny gymnastics).

But, if you switched to a 64bit computer, it is quite possible that you are not able to watch it again. The original plugin for Java did not use the NPAPI API (yes, this is an example of RAS syndrome), which prevents its usage through nspluginwrapper, the 32 bits adapter for 64 bits web browsers, which was the recommended solution for other proprietary plugins, such as Flash (this is no more the case).

What were the other solutions? I never found that the 32 bits chroot (a more or less complete installation of the system in 32 bits inside a subdirectory of the 64 bits system) was a good solution (I have a notion of good that includes some notion of elegance and lightness and precludes a notion of redundancy). It was but the only one to work correctly everywhere.

An old version of Java 1.4.2 made by Blackdown (I used the one packed by François Boisson) could still be found and worked... so-so. But it was not compatible with the concurrent installation of other Java versions, which was troublesome. Some applets did not work, requiring a Java 1.5 or better. But it was a 64 bits native plugin (unless I am mistaken).

Rumors are abound about an icedtea plugin (freed version of the Sun environment), about the plugin bound with gcj (a java environment completely distinct from Sun's)... I tried a few, including Ubuntu packages or native debian, but no way: it wouldn't work everywhere, or it wouldn't fit with other packages... or else.

Lastly, during December, an "early access" version of the environment JDK6 of Sun (under a proprietary license, whereas JDK7 is now under a free license) (I skip the details, it's a bit complicated because there also exists a free JDK6, but based on the JDK7; anyway, the early access version I downloaded looks to be non-free). One of the changes is the appearance of a native 64 bits plugin, with no work to run it inside a 64 bit browser (well, building the package is not that simple, as we will see)...

And now, I can again view my java applets and breathe again!

I will thus detail below the procedure I used to build an installable Debian package (sid/unstable) using this version of Java and the accompanying plugin with the debian tools (files managed by dpkg). The installation bound with the program by Sun surely works (out of the system, or rather in the middle of it), it has been described elsewhere and honestly does not require many comments.

Procedure for generating a debian package

It's a bit "as is", with the procedure such as I used it around 12/2008. It may contain faults (e.g., I see that there exists a b03 build that is probably better than the b02 build now). I did everything in a clean pbuilder, to be sure htat nothing is specific to my system.

  • pbuiler update && pbuilder login
  • echo 'deb http://ftp.fr.debian.org/debian sid main contrib' > /etc/apt/sources.list
  • apt-get update
  • apt-get install java-package wget vim (or your preferred editor)
  • wget http://www.java.net/download/jdk6/6u12/promoted/b02/binaries/jdk-6u12-ea-bin-b02-linux-amd64-08_dec_2008.bin
  • vim +101 /usr/share/java-package/sun-j2sdk.sh
  • Add: (around line 101)
            "jdk-6u"[0-9][0-9]"-linux-x64.bin") # SUPPORTED
    j2se_version=1.6.0+update${archive_name:6:2}${revision}
    j2se_expected_min_size=130
    found=true
    ;;
  • vim /usr/share/java-package/sun-j2sdk1.6/install
  • Remove the sections about firefox and netscape, and remove ns7/ in mozilla and iceweasel by putting $plugin_dir/libnpjp.so instead
  • Replace plugin_dir's definition with:
  • plugin_dir="$j2se_base/jre/lib/$arch_dir"
  • vi +15 /usr/share/java-package/j2sdk.sh
  • Replace Recommends with Suggests. And add at the ens fin :
    , sun-java${j2se_release:3:1}-jre, sun-java${j2se_release:3:1}-jdk
  • mv jdk-6u12-ea-bin-b02-linux-amd64-08_dec_2008.bin tmp/jdk-6u12-linux-x64.bin
  • useradd jcdubacq
  • cd /tmp
  • su -c 'fakeroot make-jpkg --full-name "Jean-Christophe Dubacq" --email jcdubacq1@free.fr --revision 1 jdk-6u12-linux-x64.bin' jcdubacq
  • cp sun-j2sdk1.6_1.6.0+update12-1_amd64.deb /usr/src/packages/ (or any other way to copy it to your main system, my pbuilder has this directory bind-mounted)

That's all! If you have comments on this procedure, do not hesitate. I had afterthoughts about submitting bugs for the various little things missing in java-package pointed out by this packaging. I am under the impression that java-package is a bit obsolete, and I wanted it to rest peacefully in its corner for a temporary and hopefully to be replaced by an official openJDK7 with full functionality (but still useful while waiting for a 64 bits plugin).

This package was built by me, with my small knowledge of Debian (esp. Java) packaging. For Java, I am just a casual user of the compiler (and applets). I am thereforer interested in more robust and cleaner methods. Given the size of the generated packages (several dozens of MB), I will not make them available, it's a bit big for my small site...