Thu, 27 Mar 2008

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.

[] | # Read Comments (8) |

Comments

debconf-set-selections also accepts input from stdin so you could also do:

echo sun-java5-jdk shared/accepted-sun-dlj-v1-1 select true | /usr/bin/debconf-set-selections
echo sun-java5-jre shared/accepted-sun-dlj-v1-1 select true | /usr/bin/debconf-set-selections
echo sun-java6-jdk shared/accepted-sun-dlj-v1-1 select true | /usr/bin/debconf-set-selections
echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | /usr/bin/debconf-set-selections

Useful if you are installing java in a bash script and don't want to create a seperate file.
Posted by Jeff Rebeiro at Mon Dec 1 20:02:26 2008
Hi Jeff,

Thank you SO very much for this information.  I'm using an Emulab-like environment in which I install nodes with Java all the time, finally I found your great post about this!

Thanks!

SabbeRubbish
Posted by SabbeRubbish at Sun Apr 19 23:33:59 2009
By the way, you don't happen to know a way of installing xorg so that it doesn't prompt for the screen resolutions?  That's the only thing left for full automation.

So when I
apt-get -y install xorg
the installer asks my which screen resolutions I want to use.  The defaults are fine for me, but how do I disable this (for me) redundant prompt?

Thanks even more! :)

SabbeRubbish
Posted by SabbeRubbish at Sun Apr 19 23:37:44 2009
Thanks a lot!
Posted by anonymous at Thu Jul 2 16:20:29 2009
Just to make it a bit easier on my eyes in script :)

  cat << EOF | /usr/bin/debconf-set-selections
  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 
EOF
Posted by TGM at Sat Jul 11 14:52:34 2009
thank you very much (i "dont" "ever" "never" say this line frequently).
now with this little help i can upload a shitload of packages while running debian-live. just i needed a few packages where i need to accept licence dialog.
thanks thanks and thanks.
bill the beer to this dude on my account.
thanks. CIAO
-paul
Posted by partho at Sat Aug 1 23:42:27 2009
David,

Thanks for this it has saved me lots of time.
Posted by James Page at Wed Jan 12 15:59:59 2011
Neat! Really great help if you want to install Sun Java on a Debian Live stick.
Posted by Matthias at Wed Apr 13 18:06:42 2011

Name:


E-mail:


URL:


Comment:


Please enter "fudge" to prove you are a human