Skip to content

Instantly share code, notes, and snippets.

@jamieparfet
Last active September 10, 2020 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamieparfet/79451dff1f6e10d95dbf660513ce695e to your computer and use it in GitHub Desktop.
Save jamieparfet/79451dff1f6e10d95dbf660513ce695e to your computer and use it in GitHub Desktop.
#!/bin/bash
dpkg-query -W -f='${binary:Package}\n' | grep -E -e '^(ia32-)?(sun|oracle)-java' -e '^openjdk-' -e '^icedtea' -e '^(default|gcj)-j(re|dk)' -e '^gcj-(.*)-j(re|dk)' -e '^java-common' | xargs sudo apt-get -y remove
sudo apt-get -y autoremove
# beware - this removes virtualbox config files
dpkg -l | grep ^rc | awk '{print($2)}' | xargs sudo apt-get -y purge
mkdir /opt/jdk
# download 'jdk-8u221-linux-x64.tar.gz'
tar -zxf jdk-8u221-linux-x64.tar.gz -C /opt/jdk
update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_221/bin/java 100
update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_221/bin/javac 100
java -version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment