Homebrew에서 java를 설치하는 방법
11535 단어 homebrew-caskMac자바homebrew
java11 설치
% brew update
Updated 3 taps (homebrew/core, homebrew/cask and homebrew/cask-fonts).
==> New Formulae
# ...省略...
# バージョンを見てみる
% brew -v
Homebrew 2.5.6
Homebrew/homebrew-core (git revision 50dda; last commit 2020-10-23)
Homebrew/homebrew-cask (git revision fb5c8; last commit 2020-10-23)
# Homebrewが元気かお医者さんに聞いておく
% brew doctor
Your system is ready to brew.
# インストールしちゃってないか確認する
% /usr/libexec/java_home -V
Unable to find any JVMs matching version "(null)".
Matching Java Virtual Machines (0):
Default Java Virtual Machines (0):
No Java runtime present, try --request to install.
# java11を探す
% brew search java11
==> Formulae
java11
# インストールする
% brew install java11
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
Updated 1 formula.
==> Updated Casks
blueharvest cctalk chromium
==> Downloading https://homebrew.bintray.com/bottles/openjdk%4011-11.0.8.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/5cf17a69c7f88b8f721959391d89eafcf1dc6ebcbe5f1496b99448ac9fce0c1d?response-content-disposi
######################################################################## 100.0%
==> Pouring [email protected]
==> Caveats
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
openjdk@11 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have openjdk@11 first in your PATH run:
echo 'export PATH="/usr/local/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc
For compilers to find openjdk@11 you may need to set:
export CPPFLAGS="-I/usr/local/opt/openjdk@11/include"
==> Summary
🍺 /usr/local/Cellar/openjdk@11/11.0.8: 650 files, 295.3MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/ponsuke/Library/Caches/Homebrew/git--2.28.0.catalina.bottle.tar.gz... (19.4MB)
Removing: /Users/ponsuke/Library/Caches/Homebrew/Cask/pycharm-ce--2020.2.2,202.7319.64.dmg... (381.6MB)
# インストールのメッセージにある通り環境変数を設定する
% echo 'export PATH="/usr/local/opt/openjdk@11/bin:$PATH"' >> ~/.zshrc
% export CPPFLAGS="-I/usr/local/opt/openjdk@11/include"
% source ~/.zshrc
# バージョンを確認する
% java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+11)
OpenJDK 64-Bit Server VM (build 11.0.8+11, mixed mode)
java6 설치
오라클의 사이트에 MacOS가 없기 때문에 Homebrew를 사용하기로 했다.
Homebrew를 사용하지 않고 Apple 지원 페이지에서 다운로드하여 설치할 수도 있습니다.
(하지 않아도 좋지만) 사전 준비
# アップデートしておく
$ brew update
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
# <省略>
$ brew -v
Homebrew 2.1.4
Homebrew/homebrew-core (git revision d2f75; last commit 2019-06-03)
Homebrew/homebrew-cask (git revision db1f8; last commit 2019-06-03)
# Homebrewが元気かお医者さんに聞いておく
$ brew doctor
Your system is ready to brew.
# インストールしちゃってないか確認する
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (3):
1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
1.8.0_45, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
1.7.0_67, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
cask-versions를 brew tap 한다
이전 버전을 설치하려면 homebrew-cask-versions 을 tap하다
# cask-versionsをtapする
$ brew tap homebrew/cask-versions
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
No changes to formulae.
==> Tapping homebrew/cask-versions
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask-versions'...
remote: Enumerating objects: 198, done.
remote: Counting objects: 100% (198/198), done.
remote: Compressing objects: 100% (194/194), done.
remote: Total 198 (delta 9), reused 28 (delta 1), pack-reused 0
Receiving objects: 100% (198/198), 84.74 KiB | 366.00 KiB/s, done.
Resolving deltas: 100% (9/9), done.
Tapped 169 casks (216 files, 324.9KB).
# tapできたか確認する
$ brew tap
homebrew/cask
homebrew/cask-versions
homebrew/core
# java6を探す
$ brew search java6
==> Casks
java6
설치
Mac에 brew로 Oracle Java 버전을 지정하여 설치하는 방법 - Qiita
# インストールする
$ brew cask install java6
==> Satisfying dependencies
==> Downloading https://support.apple.com/downloads/DL1572/en_US/javaforosx.dmg
==> Downloading from https://updates.cdn-apple.com/2018/macos/031-33898-20171026-7a797e9e-b8de-11e7-b1fe-c14fbda7e146/javaforosx.dmg
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'java6'.
==> Installing Cask java6
==> Running installer for java6; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
installer: Package name is Java for macOS 2017-001
installer: Installing at base path /
installer: The install was successful.
🍺 java6 was successfully installed!
# インストールされているjavaを確認する
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (5):
1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
1.8.0_45, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
1.7.0_67, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home
1.6.0_65-b14-468, x86_64: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
1.6.0_65-b14-468, i386: "Java SE 6" /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Mac에서 설치된 Java를 확인하는 방법 - Qiita
(필요한 경우) 사용하는 Java 버전 간 전환
Mac에서 Java 버전을 전환하는 방법 - Qiita
Reference
이 문제에 관하여(Homebrew에서 java를 설치하는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/ponsuke0531/items/9be8dee67a91c6c78d4f
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Reference
이 문제에 관하여(Homebrew에서 java를 설치하는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ponsuke0531/items/9be8dee67a91c6c78d4f텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)