'Installing jdk17 on Mac with brew
I am trying to install jdk17 with brew, while also having java8, java11 and java16 installed.
In order to install 8, 11 and 16 I ran:
brew tap adoptopenjdk/openjdk
brew install --cask adoptopenjdk8
brew install --cask adoptopenjdk11
brew install --cask adoptopenjdk16
However there seems to be no adoptopenjdk for 17.
I can install 17 with
brew install openjdk
But if I run
/usr/libexec/java_home -v 17
it returns
/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home
and there is no entry for 17 in
/Library/Java/JavaVirtualMachines/
I am using
alias java8="unset JAVA_HOME; export JAVA_HOME=`/usr/libexec/java_home -v 1.8`; java -version"
alias java11="unset JAVA_HOME; export JAVA_HOME=`/usr/libexec/java_home -v 11`; java -version"
alias java16="unset JAVA_HOME; export JAVA_HOME=`/usr/libexec/java_home -v 16`; java -version"
alias java17="unset JAVA_HOME; export JAVA_HOME=`/usr/libexec/java_home -v 17`; java -version"
to manage the java versions, and without an entry for java 17, I can't switch to it.
Thanks.
Solution 1:[1]
Update!
After being informed by @MarkRotteveel it seems that the new website for this project is here called Adoptium. In Homebrew the package that installs the new AdoptOpenJDK seems to be here named temurin. If this is the case, all we need to run is:
brew install --cask temurin
OLD ANSWER
After searching the AdoptOpenJDK website for the latest version and even the nightly builds, it seems that there is no adoptOpenJDK17, I am afraid. If this is indeed the case, I do not see how Homebrew could serve you version 17.
If you must have JDK version 17 for Java development, try using openjdk instead if possible:
brew install openjdk
Lastly make sure to point to the correct JDK in your IDE of choice and make sure the correct path is set. For the path you may visit the /VirtualMachines folder you have gone to before as you find an alias their from Homebrew or the jdk/s itself.
Postscript: I do not use this JDK for Java development myself, so I may be wrong, but this is I got by some simple searching. I am more familiar with openJDK.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |