Friday, February 11, 2011

Scripted Java Install on Ubuntu 10

This is how you deal with installing java via command line scripts automatically, without having to click accept the licence on Ubuntu 10 (this works on both 10.04 and 10.10)

sudo echo sun-java6-jre shared/accepted-sun-dlj-v1-1 select true | sudo /usr/bin/debconf-set-selections
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install --yes sun-java6-jdk sun-java6-jre

echo "JAVA_HOME=/usr/lib/jvm/java-6-sun" >> .bashrc
echo "PATH=\$PATH:\$JAVA_HOME/bin" >> .bashrc
java -version

In short, you accept the licence prior to installing, you add the update repository, you install java, you set the JAVA_HOME variable, update the PATH, and in the end check that it all ties in perfectly.

0 comments:

Post a Comment