Some day Sun Java will be released under a free licence, and some day it will be available in Debian. Once that happens, this information will be only of historical interest... (Sept 2008)
Or alternatively, Sun^WOracle Java will become even more non-free and be completely removed from Debian. But OpenJDK is good enough that we can just ignore Oracle and be happy about it. This information is still of some interest for preseeding information into a cowbuilder in any case, hence leaving it here. (Dec 2013)


Using Sun Java inside an auto-build environment is difficult because the Debian packages require you to accept the licence prior to installation. This includes pbuilder and cowbuilder environments.

Once you have read and accepted the licence (and understood what freedoms it is not granting you), you can allow your clean pbuilder to install Sun Java by preseeding the debconf database with your agreement to the licence.


The steps given here are specific to use with a cowbuilder set up, but can be trivially adapted to other builders such as the classic pbuilder.

  1. (skip this if you already have a cowbuilder set up) Create a build chroot:
     cowbuilder --create
  2. Enter into the build environment and add the keys to the debconf database:
     chroot /var/cache/pbuilder/base.cow
  3. Into that last command, you can paste the settings (below). Alternatively, you can redirect stdin from a file to achieve the same thing.
     cp /path/to/settings/file /var/cache/pbuilder/base.cow/tmp/java.debconf
     chroot /var/cache/pbuilder/base.cow
     debconf-set-selections < /tmp/java.debconf 

Debconf settings

The debconf settings you need for Sun Java 6 are as follows (adapt them as needed to suit Java 5):

 # Do you agree with the DLJ license terms?
 sun-java6-bin shared/accepted-sun-dlj-v1-1  boolean true
 sun-java6-jdk shared/accepted-sun-dlj-v1-1  boolean true
 sun-java6-jre shared/accepted-sun-dlj-v1-1  boolean true 

Other approaches

After I originally wrote about doing this, I noticed that Mike Renfro had also discussed this on his blog, including ways of using this with puppet for easier system administration of large numbers of machines.

Last edited: Friday December 13, 2013

Valid XHTML 1.1 Valid CSS 2