-
-
Save jkone27/5ec26f62d35de013fbd7a6f168fdfae6 to your computer and use it in GitHub Desktop.
Install Oracle JDK 8 for use with SDKMAN (test macos not working)
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 | |
# | |
# not working atm, Install Oracle JDK 8 for use with SDKMAN on macOS | |
# download not working...to fix | |
# | |
# https://download.oracle.com/otn/java/jdk/8u401-b10/4d245f941845490c91360409ecffb3b4/jdk-8u401-macosx-x64.dmg | |
# https://gist.github.com/wavezhang/ba8425f24a968ec9b2a8619d7c2d86a6 | |
set -eu | |
# Updated download URL for macOS DMG | |
DOWNLOAD_URL="https://javadl.oracle.com/webapps/download/GetFile/1.8.0_401-b10/4d245f941845490c91360409ecffb3b4/macosx-x64/jdk-8u401-macosx-x64.dmg" | |
DMG="jdk-8u401-macosx-x64.dmg" | |
MOUNT_POINT="/Volumes/JDK 8 Update 391" | |
PKG="JDK 8 Update 401.pkg" | |
SDK_ID="8.0.401-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 --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "$DOWNLOAD_URL" -O "$DMG" | |
hdiutil attach "$DMG" | |
sudo installer -pkg "$MOUNT_POINT/$PKG" -target / | |
hdiutil detach "$MOUNT_POINT" | |
rm -f "$DMG" | |
echo "$SDK_ID installed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment