「Mac/インストール/java」の版間の差分
提供: 初心者エンジニアの簡易メモ
(→JavaDeveloperKit(JDK) 8インストール) |
(→複数バージョンインストール) |
||
(同じ利用者による、間の12版が非表示) | |||
行1: | 行1: | ||
+ | ==複数バージョンインストール== | ||
+ | brew tap homebrew/cask-versions | ||
+ | brew search java | ||
+ | ==> Formulae | ||
+ | google-java-format java-service-wrapper javacc jslint4java pdftk-java | ||
+ | java ✔ java11 javarepl libreadline-java | ||
+ | brew install the-unarchiver --cask | ||
+ | brew install java11 –cask | ||
+ | export JAVA_HOME=`/usr/libexec/java_home -v 11` | ||
+ | java -version | ||
+ | |||
+ | ===no longerが出る場合=== | ||
+ | $ brew cask install java11 | ||
+ | エラー詳細 | ||
+ | Error: `brew cask` is no longer a `brew` command. Use `brew <command> --cask` instead. | ||
+ | 順序を変える | ||
+ | brew install java11 –cask | ||
+ | |||
+ | ==JavaDeveloperKit(JDK) 13インストール== | ||
+ | $ brew cask install java | ||
+ | $ /usr/libexec/java_home -V | ||
+ | $ vi ~/.bash_profile | ||
+ | export JAVA_HOME=`/usr/libexec/java_home -v 13` | ||
+ | $ source ~/.bash_profile | ||
+ | $ java -version | ||
+ | openjdk version "13.0.1" 2019-10-15 | ||
+ | |||
+ | ==JavaDeveloperKit(JDK) 11インストール== | ||
+ | $ brew install --cask adoptopenjdk11 | ||
+ | $ /usr/libexec/java_home -V | ||
+ | $ vi ~/.bash_profile | ||
+ | export JAVA_HOME=`/usr/libexec/java_home -v 11` | ||
+ | $ source ~/.bash_profile | ||
+ | $ java -version | ||
+ | openjdk version "11.0.2" 2019-01-15 | ||
+ | |||
==JavaDeveloperKit(JDK) 10インストール== | ==JavaDeveloperKit(JDK) 10インストール== | ||
$ brew cask install java | $ brew cask install java | ||
行9: | 行45: | ||
==JavaDeveloperKit(JDK) 8インストール== | ==JavaDeveloperKit(JDK) 8インストール== | ||
− | $ brew cask install | + | $ brew tap homebrew/cask-versions |
+ | $ brew cask install adoptopenjdk8 | ||
$ /usr/libexec/java_home -V | $ /usr/libexec/java_home -V | ||
Matching Java Virtual Machines (2): | Matching Java Virtual Machines (2): | ||
− | + | 13.0.1, x86_64: "OpenJDK 13.0.1" /Library/Java/JavaVirtualMachines/openjdk-13.0.1.jdk/Contents/Home | |
− | + | 11.0.2, x86_64: "OpenJDK 11.0.2" /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home | |
− | + | 1.8.0_232, x86_64: "AdoptOpenJDK (OpenJ9) 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8-openj9.jdk/Contents/Home | |
$ vi ~/.bash_profile | $ vi ~/.bash_profile | ||
export JAVA_HOME=`/usr/libexec/java_home -v 1.8` | export JAVA_HOME=`/usr/libexec/java_home -v 1.8` | ||
行21: | 行58: | ||
java version "1.8.0_171" | java version "1.8.0_171" | ||
− | 参考:https://qiita.com/ | + | 参考:https://qiita.com/seijikohara/items/56cc4ac83ef9d686fab2 |
==JavaDeveloperKit(JDK) 7インストール== | ==JavaDeveloperKit(JDK) 7インストール== | ||
行29: | 行66: | ||
1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home | 1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home | ||
1.7.0_232-zulu-7.31.0.5, x86_64: "Zulu 7" /Library/Java/JavaVirtualMachines/zulu-7.jdk/Contents/Home | 1.7.0_232-zulu-7.31.0.5, x86_64: "Zulu 7" /Library/Java/JavaVirtualMachines/zulu-7.jdk/Contents/Home | ||
+ | |||
+ | ==javaのバージョンが見つからないとき== | ||
+ | <pre> | ||
+ | brew update | ||
+ | brew tap homebrew/cask-versions | ||
+ | brew tap adoptopenjdk/openjdk | ||
+ | brew search java | ||
+ | brew search jdk | ||
+ | brew cask info java11 | ||
+ | #brew cask info adoptopenjdk | ||
+ | brew cask install java11 | ||
+ | #brew cask install homebrew/cask-versions/java11 | ||
+ | </pre> | ||
+ | https://stackoverflow.com/questions/52524112/how-do-i-install-java-on-mac-osx-allowing-version-switching | ||
+ | |||
+ | ==Calling `brew cask install` is disabled! Use brew install [--cask] instead.が出るとき== | ||
+ | 以下のようにインストールコマンドが変わった | ||
+ | brew install --cask java |
2023年12月28日 (木) 06:47時点における最新版
目次
複数バージョンインストール
brew tap homebrew/cask-versions brew search java ==> Formulae google-java-format java-service-wrapper javacc jslint4java pdftk-java java ✔ java11 javarepl libreadline-java brew install the-unarchiver --cask brew install java11 –cask export JAVA_HOME=`/usr/libexec/java_home -v 11` java -version
no longerが出る場合
$ brew cask install java11
エラー詳細
Error: `brew cask` is no longer a `brew` command. Use `brew <command> --cask` instead.
順序を変える
brew install java11 –cask
JavaDeveloperKit(JDK) 13インストール
$ brew cask install java $ /usr/libexec/java_home -V $ vi ~/.bash_profile export JAVA_HOME=`/usr/libexec/java_home -v 13` $ source ~/.bash_profile $ java -version openjdk version "13.0.1" 2019-10-15
JavaDeveloperKit(JDK) 11インストール
$ brew install --cask adoptopenjdk11 $ /usr/libexec/java_home -V $ vi ~/.bash_profile export JAVA_HOME=`/usr/libexec/java_home -v 11` $ source ~/.bash_profile $ java -version openjdk version "11.0.2" 2019-01-15
JavaDeveloperKit(JDK) 10インストール
$ brew cask install java $ /usr/libexec/java_home -V $ vi ~/.bash_profile export JAVA_HOME=`/usr/libexec/java_home -v 10.0` $ source ~/.bash_profile $ java -version java version "10.0.1" 2018-04-17
JavaDeveloperKit(JDK) 8インストール
$ brew tap homebrew/cask-versions $ brew cask install adoptopenjdk8 $ /usr/libexec/java_home -V Matching Java Virtual Machines (2): 13.0.1, x86_64: "OpenJDK 13.0.1" /Library/Java/JavaVirtualMachines/openjdk-13.0.1.jdk/Contents/Home 11.0.2, x86_64: "OpenJDK 11.0.2" /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home 1.8.0_232, x86_64: "AdoptOpenJDK (OpenJ9) 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8-openj9.jdk/Contents/Home $ vi ~/.bash_profile export JAVA_HOME=`/usr/libexec/java_home -v 1.8` $ source ~/.bash_profile $ java -version java version "1.8.0_171"
参考:https://qiita.com/seijikohara/items/56cc4ac83ef9d686fab2
JavaDeveloperKit(JDK) 7インストール
$ brew cask install caskroom/versions/zulu7 $ /usr/libexec/java_home -V Matching Java Virtual Machines (2): 1.8.0_131, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home 1.7.0_232-zulu-7.31.0.5, x86_64: "Zulu 7" /Library/Java/JavaVirtualMachines/zulu-7.jdk/Contents/Home
javaのバージョンが見つからないとき
brew update brew tap homebrew/cask-versions brew tap adoptopenjdk/openjdk brew search java brew search jdk brew cask info java11 #brew cask info adoptopenjdk brew cask install java11 #brew cask install homebrew/cask-versions/java11
Calling `brew cask install` is disabled! Use brew install [--cask] instead.が出るとき
以下のようにインストールコマンドが変わった
brew install --cask java