Installing java non-interactively
Installing the Sun Java packages on Debian or Ubuntu require to you accept Sun's license before you can install them. This means that it's not easy to install non-interactively, for example when using pbuilder. Fortunately the license uses debconf to check to see if you have already accepted the license. This means you can use debconf to accept the license before you install the packages. Create a file containing the following lines:
sun-java5-jdk shared/accepted-sun-dlj-v1-1 select true sun-java5-jre shared/accepted-sun-dlj-v1-1 select true sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true sun-java6-jre shared/accepted-sun-dlj-v1-1 select true
Then run /usr/bin/debconf-set-selections <file> and when you install the java packages, you should find it doesn't prompt for the license any more.