Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install openjdk with brew? [closed]

Tags:

java

homebrew

Seems like there's 3 packages "openjdk", "cask java" and "adoptopenjdk".

Which one should be used?

like image 617
Alex Craft Avatar asked Aug 07 '20 21:08

Alex Craft


People also ask

Where is OpenJDK installed Mac brew?

1.4 brew install java to install the latest JDK 15. 1.5 Where does Homebrew install the java? Homebrew installed the JDK files and directories at /usr/local/Cellar/openjdk/ , and symbolic link at /usr/local/opt/openjdk points to the latest Java 15.0. 1 version.


3 Answers

Run brew install openjdk@11

In case you are managing java versions with jenv, also run:

sudo ln -sfn /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
jenv add /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home/
like image 82
saysiva Avatar answered Oct 16 '22 13:10

saysiva


To install latest:

brew cask install adoptopenjdk

To install a specific version

brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
brew cask install adoptopenjdk9
like image 13
SkillsIndexOutOfBounds Avatar answered Oct 16 '22 13:10

SkillsIndexOutOfBounds


You can use AdoptOpenJDK for brew

like image 6
Andrew Vershinin Avatar answered Oct 16 '22 14:10

Andrew Vershinin