dotfiles/scripts/java.sh

34 lines
982 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
VERSION="16.0.2"
function install () {
cd ~
wget https://download.java.net/java/GA/jdk${VERSION}/d4a915d82b4c4fbb9bde534da945d746/7/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz
wget https://download.java.net/java/GA/jdk${VERSION}/d4a915d82b4c4fbb9bde534da945d746/7/GPL/openjdk-${VERSION}_linux-x64_bin.tar.gz.sha256
sha256sum openjdk-${VERSION}_linux-x64_bin.tar.gz
sudo tar xvf openjdk-${VERSION}_linux-x64_bin.tar.gz
2021-11-24 14:14:39 +00:00
sudo mv jdk-${VERSION} /opt/java
sudo rm openjdk-${VERSION}_linux-x64_bin.tar.gz
sudo rm openjdk-${VERSION}_linux-x64_bin.tar.gz.sha256
}
2021-08-17 05:08:52 +00:00
function install_alt () {
cd ~
sudo apt-get install -y openjdk-17-jre openjdk-17-jdk
2021-08-17 05:08:52 +00:00
printf "\n\n"
java --version
printf "\n"
javac --version
}
if [ "$1" == "install" ]; then
install
2021-08-17 05:08:52 +00:00
elif [ "$1" == "install_alt" ]; then
install_alt
# elif [ "$1" == "uninstall" ] || [ "$1" == "remove" ]; then
# uninstall
else
echo "please specify args with install or uninstall"
fi