본문 바로가기
프로그래밍/Java OpenJDK 설치

Mac에 OpenJDK 설치하기

by Flow.X 2022. 1. 11.
728x90

Oracle JDK, OpenJDK, AdoptOpenJDK

JDK의 경우 Oracle에서 제공하는 JDK와  오라클에서 Build하는 OpenJDK, 커뮤니티에서 Build하는 AdoptOpenJDK등이

대표적이고, 그리고 각 사이트에서 제공되는 다양한 OpenJDK가 있다,

 

다양한 JDK에 대한  비교는 아래에서 볼수가 있다

https://en.wikipedia.org/wiki/Comparison_of_Java_virtual_machines

 

Comparison of Java virtual machines - Wikipedia

From Wikipedia, the free encyclopedia Jump to navigation Jump to search This article needs to be updated. Please help update this article to reflect recent events or newly available information. (March 2019) Version information[edit] Technical information[

en.wikipedia.org

Java 버전 확인

[flowx@dev:~] java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)

설치되어있는 Java버전 확인하는 방법

[flowx@dev:~] /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    11.0.11 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
    1.8.0_292 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
[flowx@dev:~]

Homebrew를 통한 Mac에 Java 설치

여기를 참조하면 Homebrew에 대해 알수있다.

비밀번호 입력하고, 엔터키 치면 설치

[flowx@dev:~] /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
==> Checking for `sudo` access (which may request your password)...
Password: *******
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort:

brew를 통한 AdoptopenJDK설치

# AdoptOpenJDK 저장소를 추가하고
[flowx@dev:~] brew tap adoptopenjdk/openjdk 

# AdoptOpenJDK 설치 ( 11버전 예시 )
[flowx@dev:~] brew install --cask adoptopenjdk11

# AdoptOpenJDK 업데이트 ( 11버전 예시 )
[flowx@dev:~] brew upgrade adoptopenjdk11

# AdoptOpenJDK 재설치( 11버전 예시 )
[flowx@dev:~] brew reinstall adoptopenjdk11

# AdoptOpenJDK 삭제( 11버전 예시 )
[flowx@dev:~] brew uninstall adoptopenjdk11

# 저장소 제거
[flowx@dev:~] brew untap adoptopenjdk/openjdk

https://github.com/AdoptOpenJDK/homebrew-openjdk 에서 설치가능한 버전을 볼수 있다. 

Java AdoptOpenJDK 버전 리스트

brew 관련 명령어 ( 상세페이지 )

찌거기를 날려버리는 명령어 

brew cleanup

상세정보 보기

brew ls adoptopenjdk11
728x90