본문 바로가기

맥(솔라리스)

macOS에서 Brew 패키지 매니저를 사용하여 JAVA 11을 설치하는 방법

반응형

macOS에서 Brew 패키지 매니저를 사용하여 JAVA 11을 설치하는 방법

Homebrew가 설치되어 있는지 확인

brew --version

Homebrew가 설치되어 있지 않다면, Homebrew를 설치

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Zulu JDK 11 설치

brew tap mdogan/zulu
> brew tap mdogan/zulu
==> Tapping mdogan/zulu
Cloning into '/opt/homebrew/Library/Taps/mdogan/homebrew-zulu'...
remote: Enumerating objects: 530, done.
remote: Counting objects: 100% (105/105), done.
remote: Compressing objects: 100% (42/42), done.
remote: Total 530 (delta 73), reused 75 (delta 52), pack-reused 425
Receiving objects: 100% (530/530), 162.67 KiB | 5.81 MiB/s, done.
Resolving deltas: 100% (302/302), done.
Tapped 13 casks (53 files, 292.6KB).
brew install zulu-jdk11
> brew install zulu-jdk11
==> Downloading https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.dmg
######################################################################## 100.0%
==> Installing Cask zulu-jdk11
==> Running installer for zulu-jdk11; your password may be necessary.
Package installers may write to any location; options such as `--appdir` are ignored.
Password:
installer: Package name is Azul Zulu JDK 11.56+19
installer: Installing at base path /
installer: The install was successful.
🍺  zulu-jdk11 was successfully installed!

java 버전 확인

java --version
> java --version
openjdk 11.0.15 2022-04-19 LTS
OpenJDK Runtime Environment Zulu11.56+19-CA (build 11.0.15+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.56+19-CA (build 11.0.15+10-LTS, mixed mode)

Java 환경 변수인 JAVA_HOME을 등록하는 방법

.zshrc 편집

vim ~/.zshrc
export JAVA_HOME=`/usr/libexec/java_home -v 11`
export PATH=$PATH:$JAVA_HOME/bin
source ~/.zshrc

JAVA_HOME 환경 변수 확인

echo $JAVA_HOME
> echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home

 

참고사이트

Azul Zulu : https://docs.azul.com/core/zulu-openjdk/install/macos

 

728x90
반응형