Last active
April 21, 2025 05:44
-
-
Save smola/b1332103514a7834cabca6af7bb09ceb to your computer and use it in GitHub Desktop.
Install Oracle JDK 8 for use with SDKMAN
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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