Skip to content

Instantly share code, notes, and snippets.

@xyombo
Forked from smola/sdkman_oracle_jdk.sh
Created June 21, 2023 03:31
Show Gist options
  • Save xyombo/e11f0a2ae992c952eb2b1b549a00cef7 to your computer and use it in GitHub Desktop.
Save xyombo/e11f0a2ae992c952eb2b1b549a00cef7 to your computer and use it in GitHub Desktop.
Install Oracle JDK 8 for use with SDKMAN
#!/bin/bash
#
# Install Oracle JDK 8 for use with SDKMAN
#
set -eu
# This URL can be discovered using https://sites.google.com/view/java-se-download-url-converter
DOWNLOAD_URL="https://javadl.oracle.com/webapps/download/GetFile/1.8.0_331-b09/165374ff4ea84ef0bbd821706e29b123/linux-i586/jdk-8u331-linux-x64.tar.gz"
TARBALL="jdk-8u331-linux-x64.tar.gz"
DIRNAME="jdk1.8.0_331"
SDK_ID="8.0.331-oracle"
if [[ -z ${SDKMAN_DIR:-} ]]; then
echo 'Error: ${SDKMAN_DIR} not defined'
exit 1
fi
mkdir -p "$SDKMAN_DIR/candidates/java"
cd "$SDKMAN_DIR/candidates/java"
if [[ -e "$SDK_ID" ]]; then
echo "$SDK_ID already installed"
exit 0
fi
wget "$DOWNLOAD_URL"
tar xvzf "$TARBALL"
mv -f "$DIRNAME" "$SDK_ID"
rm -f "$TARBALL"
echo "$SDK_ID installed"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment