Just came across JavaPackage in Debian. This allows you to cleanly replace OpenJDK with a complying alternative systemwide, the Debian Way. I was only interested in the Oracle JDK, and that worked a treat, not sure about other JDKs. In essence:
- Install the JavaPackage package using apt[itude]
- Download the .tar.gz JDK package from Oracle
- Run make-jpkg, installed as part of JavaPackage, against it (not as root); this produces a Debian package of the tarball
- Install the Debian package using dpkg
- Finally, use update-java-alternatives to update various Java-related symlinks systemwide. You can choose to only update a subset (e.g. just use the Oracle JDK for the browser plugins, but nothing else), or go the whole hog — all JDK binaries will then be from the Oracle JDK.
The wiki link has examples and details.
PS. I really miss saying “Sun JDK”.