Skip to content

Instantly share code, notes, and snippets.

@kszarek
Created August 20, 2015 20:26
Show Gist options
  • Save kszarek/7f40772b21832a526038 to your computer and use it in GitHub Desktop.
Save kszarek/7f40772b21832a526038 to your computer and use it in GitHub Desktop.
Install Java on Ubuntu
#!/bin/bash
set -xe
echo "Add repository and install java"
apt-get -y install python-software-properties
add-apt-repository -y ppa:webupd8team/java
apt-get -q -y update
apt-get -y upgrade
echo "Accept license"
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections
apt-get -y install oracle-java8-installer
echo "Update default java"
update-java-alternatives -s java-8-oracle
echo "Set environment variables"
apt-get -y install oracle-java8-set-default
echo "Check installation"
java -version
javac -version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment