If you need to have openjdk first in your PATH, run:Įcho 'export PATH='/usr/local/opt/openjdk/bin:$PATH'' > ~/.profileįor compilers to find openjdk you may need to set:Įxport CPPFLAGS='-I/usr/local/opt/openjdk/include' Openjdk is keg-only, which means it was not symlinked into /usr/local,īecause macOS provides similar software and installing this software in Sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk => Pouring openjdk-15.0.2.big_įor the system Java wrappers to find this JDK, symlink it with This will take a few minutes brew install java Openjdk: stable 15.0.2 (bottled) ĭevelopment kit for the Java programming language
Check the Java in BrewĪt the time of installing, the latest stable version is 15.0.2 $ brew info java Assuming you have installed Homebrew already, otherwise, you can go to the official website of homebrew and install it first, after that, use the following commands will help you install the latest Java (OpenJDK) in your Macġ.