Skip to main content
deleted 43 characters in body
Source Link
Brad Parks
  • 2.6k
  • 1
  • 25
  • 27

You can also install openjdk using this bash script, which gets OpenJDK from Zulu, a commercial vendor that builds and releases OpenJDK free of charge here

You can just manually install it from the above link!

You can also install openjdk using this bash script, which gets OpenJDK from Zulu, a commercial vendor that builds and releases OpenJDK free of charge here

You can just manually install it from the above link!

You can also install openjdk from Zulu, a commercial vendor that builds and releases OpenJDK free of charge here

You can just manually install it from the above link!

deleted 2290 characters in body
Source Link
Brad Parks
  • 2.6k
  • 1
  • 25
  • 27

You can also install openjdk using this bash script, which gets OpenJDK from Zulu, a commercial vendor that builds and releases OpenJDK free of charge here

You can just manually install it from the above link, or use this script. Your call!

#openjdk_install_on_mac.sh

#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; PATH="$DIR:$PATH"
ME=$(basename $0)

show_help()
{
  NEW_HOME9="$JDK_HOME/openjdk9"
  IT=$(cat <<EOF

  Installs the latest OpenJDK on your mac, version 8 by default

  usage: sudo $ME {OPENJDK FOLDER NAME} {JDK_VERSION_TO_DOWNLOAD}

  e.g.

  sudo $ME openjdk8    # installs openjdk 8 to $NEW_HOME on your machine.
  sudo $ME openjdk9 9  # installs openjdk 9 to $NEW_HOME9 on your machine.
EOF
  )
  echo "$IT"
  exit
}

if [ "$1" == "help" ]
then
  show_help
fi

# Ensure running as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root."
   echo "To do this, run 'sudo $ME' instead." 
   exit 1
fi

JDK_HOME="/Library/Java/JavaVirtualMachines"
JDK_VERSION=${2:-8}
JDK_NAME=${1:-openjdk$JDK_VERSION}
NEW_HOME="$JDK_HOME/$JDK_NAME"

# Ensure no jdk already in target folder 
if [ -d "$NEW_HOME" ]; then
  echo "A JDK is already installed at $NEW_HOME"
  echo "Please supply a unique name and try again!"
  exit 1
fi

echo
echo "About to install openjdk to $NEW_HOME"
read -n1 -r -p "Press any key to continue, or Ctrl-C to abort"
echo

url_extract()
{
  tr '"' '\n' | tr "'" '\n' | grep -e ^https:// -e ^http:// -e^// | sort | uniq
}

FILE=/tmp/__jdk_info
curl -s -o $FILE https://cdn.azul.com/zulu/bin/
NEWEST_OPENJDK=$(cat "$FILE" | url_extract | grep "zulu$JDK_VERSION" | grep tar.gz | grep -v pdf | tail -n1)
rm $FILE

echo "About to download latest version of JDK from"
echo "$NEWEST_OPENJDK"
echo "..."
sleep 0.5

FILE=/tmp/__openjdk_download.tar.gz
echo "$NEWEST_OPENJDK"
curl -o "$FILE" "$NEWEST_OPENJDK"

DIR=/tmp/__openjdk
mkdir -p "$DIR"
tar zxvf "$FILE" -C "$DIR"
rm $FILE

mv "$DIR/"* "$NEW_HOME"
rm -fr "$DIR"

echo
echo "Installation Complete!"
echo
echo "OpenJDK now available at $NEW_HOME"

You can also install openjdk using this bash script, which gets OpenJDK from Zulu, a commercial vendor that builds and releases OpenJDK free of charge here

You can just manually install it from the above link, or use this script. Your call!

#openjdk_install_on_mac.sh

#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; PATH="$DIR:$PATH"
ME=$(basename $0)

show_help()
{
  NEW_HOME9="$JDK_HOME/openjdk9"
  IT=$(cat <<EOF

  Installs the latest OpenJDK on your mac, version 8 by default

  usage: sudo $ME {OPENJDK FOLDER NAME} {JDK_VERSION_TO_DOWNLOAD}

  e.g.

  sudo $ME openjdk8    # installs openjdk 8 to $NEW_HOME on your machine.
  sudo $ME openjdk9 9  # installs openjdk 9 to $NEW_HOME9 on your machine.
EOF
  )
  echo "$IT"
  exit
}

if [ "$1" == "help" ]
then
  show_help
fi

# Ensure running as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root."
   echo "To do this, run 'sudo $ME' instead." 
   exit 1
fi

JDK_HOME="/Library/Java/JavaVirtualMachines"
JDK_VERSION=${2:-8}
JDK_NAME=${1:-openjdk$JDK_VERSION}
NEW_HOME="$JDK_HOME/$JDK_NAME"

# Ensure no jdk already in target folder 
if [ -d "$NEW_HOME" ]; then
  echo "A JDK is already installed at $NEW_HOME"
  echo "Please supply a unique name and try again!"
  exit 1
fi

echo
echo "About to install openjdk to $NEW_HOME"
read -n1 -r -p "Press any key to continue, or Ctrl-C to abort"
echo

url_extract()
{
  tr '"' '\n' | tr "'" '\n' | grep -e ^https:// -e ^http:// -e^// | sort | uniq
}

FILE=/tmp/__jdk_info
curl -s -o $FILE https://cdn.azul.com/zulu/bin/
NEWEST_OPENJDK=$(cat "$FILE" | url_extract | grep "zulu$JDK_VERSION" | grep tar.gz | grep -v pdf | tail -n1)
rm $FILE

echo "About to download latest version of JDK from"
echo "$NEWEST_OPENJDK"
echo "..."
sleep 0.5

FILE=/tmp/__openjdk_download.tar.gz
echo "$NEWEST_OPENJDK"
curl -o "$FILE" "$NEWEST_OPENJDK"

DIR=/tmp/__openjdk
mkdir -p "$DIR"
tar zxvf "$FILE" -C "$DIR"
rm $FILE

mv "$DIR/"* "$NEW_HOME"
rm -fr "$DIR"

echo
echo "Installation Complete!"
echo
echo "OpenJDK now available at $NEW_HOME"

You can also install openjdk using this bash script, which gets OpenJDK from Zulu, a commercial vendor that builds and releases OpenJDK free of charge here

You can just manually install it from the above link!

fixed broken links
Source Link
Brad Parks
  • 2.6k
  • 1
  • 25
  • 27

You can also install openjdk using this bash script, which gets OpenJDK from Zulu, a commercial vendor that builds and releases OpenJDK free of charge herefree of charge here

#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; PATH="$DIR:$PATH"
ME=$(basename $0)

show_help()
{
  NEW_HOME9="$JDK_HOME/openjdk9"
  IT=$(cat <<EOF

  Installs the latest OpenJDK on your mac, version 8 by default

  usage: sudo $ME {OPENJDK FOLDER NAME} {JDK_VERSION_TO_DOWNLOAD}

  e.g.

  sudo $ME openjdk8    # installs openjdk 8 to $NEW_HOME on your machine.
  sudo $ME openjdk9 9  # installs openjdk 9 to $NEW_HOME9 on your machine.
EOF
  )
  echo "$IT"
  exit
}

if [ "$1" == "help" ]
then
  show_help
fi

# Ensure running as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root."
   echo "To do this, run 'sudo $ME' instead." 
   exit 1
fi

JDK_HOME="/Library/Java/JavaVirtualMachines"
JDK_VERSION=${2:-8}
JDK_NAME=${1:-openjdk$JDK_VERSION}
NEW_HOME="$JDK_HOME/$JDK_NAME"

# Ensure no jdk already in target folder 
if [ -d "$NEW_HOME" ]; then
  echo "A JDK is already installed at $NEW_HOME"
  echo "Please supply a unique name and try again!"
  exit 1
fi

echo
echo "About to install openjdk to $NEW_HOME"
read -n1 -r -p "Press any key to continue, or Ctrl-C to abort"
echo

url_extract()
{
  tr '"' '\n' | tr "'" '\n' | grep -e ^https:// -e ^http:// -e^// | sort | uniq
}

FILE=/tmp/__jdk_info
curl -s -o $FILE https://wwwcdn.azul.com/downloads/zulu/zulu-macbin/
NEWEST_OPENJDK=$(cat "$FILE" | url_extract | grep "zulu$JDK_VERSION" | grep tar.gz | grep -v pdf | tail -n1)
rm $FILE

echo "About to download latest version of JDK from"
echo "$NEWEST_OPENJDK"
echo "..."
sleep 0.5

FILE=/tmp/__openjdk_download.tar.gz
echo "$NEWEST_OPENJDK"
curl -o "$FILE" "$NEWEST_OPENJDK"

DIR=/tmp/__openjdk
mkdir -p "$DIR"
tar zxvf "$FILE" -C "$DIR"
rm $FILE

mv "$DIR/"* "$NEW_HOME"
rm -fr "$DIR"

echo
echo "Installation Complete!"
echo
echo "OpenJDK now available at $NEW_HOME"

You can also install openjdk using this bash script, which gets OpenJDK from Zulu, a commercial vendor that builds and releases OpenJDK free of charge here

#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; PATH="$DIR:$PATH"
ME=$(basename $0)

show_help()
{
  NEW_HOME9="$JDK_HOME/openjdk9"
  IT=$(cat <<EOF

  Installs the latest OpenJDK on your mac, version 8 by default

  usage: sudo $ME {OPENJDK FOLDER NAME} {JDK_VERSION_TO_DOWNLOAD}

  e.g.

  sudo $ME openjdk8    # installs openjdk 8 to $NEW_HOME on your machine.
  sudo $ME openjdk9 9  # installs openjdk 9 to $NEW_HOME9 on your machine.
EOF
  )
  echo "$IT"
  exit
}

if [ "$1" == "help" ]
then
  show_help
fi

# Ensure running as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root."
   echo "To do this, run 'sudo $ME' instead." 
   exit 1
fi

JDK_HOME="/Library/Java/JavaVirtualMachines"
JDK_VERSION=${2:-8}
JDK_NAME=${1:-openjdk$JDK_VERSION}
NEW_HOME="$JDK_HOME/$JDK_NAME"

# Ensure no jdk already in target folder 
if [ -d "$NEW_HOME" ]; then
  echo "A JDK is already installed at $NEW_HOME"
  echo "Please supply a unique name and try again!"
  exit 1
fi

echo
echo "About to install openjdk to $NEW_HOME"
read -n1 -r -p "Press any key to continue, or Ctrl-C to abort"
echo

url_extract()
{
  tr '"' '\n' | tr "'" '\n' | grep -e ^https:// -e ^http:// -e^// | sort | uniq
}

FILE=/tmp/__jdk_info
curl -s -o $FILE https://www.azul.com/downloads/zulu/zulu-mac/
NEWEST_OPENJDK=$(cat "$FILE" | url_extract | grep "zulu$JDK_VERSION" | grep tar.gz | grep -v pdf | tail -n1)
rm $FILE

echo "About to download latest version of JDK from"
echo "$NEWEST_OPENJDK"
echo "..."
sleep 0.5

FILE=/tmp/__openjdk_download.tar.gz
echo "$NEWEST_OPENJDK"
curl -o "$FILE" "$NEWEST_OPENJDK"

DIR=/tmp/__openjdk
mkdir -p "$DIR"
tar zxvf "$FILE" -C "$DIR"
rm $FILE

mv "$DIR/"* "$NEW_HOME"
rm -fr "$DIR"

echo
echo "Installation Complete!"
echo
echo "OpenJDK now available at $NEW_HOME"

You can also install openjdk using this bash script, which gets OpenJDK from Zulu, a commercial vendor that builds and releases OpenJDK free of charge here

#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"; PATH="$DIR:$PATH"
ME=$(basename $0)

show_help()
{
  NEW_HOME9="$JDK_HOME/openjdk9"
  IT=$(cat <<EOF

  Installs the latest OpenJDK on your mac, version 8 by default

  usage: sudo $ME {OPENJDK FOLDER NAME} {JDK_VERSION_TO_DOWNLOAD}

  e.g.

  sudo $ME openjdk8    # installs openjdk 8 to $NEW_HOME on your machine.
  sudo $ME openjdk9 9  # installs openjdk 9 to $NEW_HOME9 on your machine.
EOF
  )
  echo "$IT"
  exit
}

if [ "$1" == "help" ]
then
  show_help
fi

# Ensure running as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root."
   echo "To do this, run 'sudo $ME' instead." 
   exit 1
fi

JDK_HOME="/Library/Java/JavaVirtualMachines"
JDK_VERSION=${2:-8}
JDK_NAME=${1:-openjdk$JDK_VERSION}
NEW_HOME="$JDK_HOME/$JDK_NAME"

# Ensure no jdk already in target folder 
if [ -d "$NEW_HOME" ]; then
  echo "A JDK is already installed at $NEW_HOME"
  echo "Please supply a unique name and try again!"
  exit 1
fi

echo
echo "About to install openjdk to $NEW_HOME"
read -n1 -r -p "Press any key to continue, or Ctrl-C to abort"
echo

url_extract()
{
  tr '"' '\n' | tr "'" '\n' | grep -e ^https:// -e ^http:// -e^// | sort | uniq
}

FILE=/tmp/__jdk_info
curl -s -o $FILE https://cdn.azul.com/zulu/bin/
NEWEST_OPENJDK=$(cat "$FILE" | url_extract | grep "zulu$JDK_VERSION" | grep tar.gz | grep -v pdf | tail -n1)
rm $FILE

echo "About to download latest version of JDK from"
echo "$NEWEST_OPENJDK"
echo "..."
sleep 0.5

FILE=/tmp/__openjdk_download.tar.gz
echo "$NEWEST_OPENJDK"
curl -o "$FILE" "$NEWEST_OPENJDK"

DIR=/tmp/__openjdk
mkdir -p "$DIR"
tar zxvf "$FILE" -C "$DIR"
rm $FILE

mv "$DIR/"* "$NEW_HOME"
rm -fr "$DIR"

echo
echo "Installation Complete!"
echo
echo "OpenJDK now available at $NEW_HOME"
Source Link
Brad Parks
  • 2.6k
  • 1
  • 25
  • 27
Loading