I am looking to install Java on Mac using Homebrew. This works fine using the command brew cask install java.This installs the latest stable version which is currently - 1.8.0_141 However how can I install a specific version for example 1.8.0_131.
- effectif.com/mac-os-x/… this could help youNicholas Tsaoucis– Nicholas Tsaoucis2017-06-19 13:49:48 +00:00Commented Jun 19, 2017 at 13:49
- Not an exact duplicate, but the answer is there: stackoverflow.com/questions/26252591/…Stijn Van Bael– Stijn Van Bael2017-09-26 09:33:20 +00:00Commented Sep 26, 2017 at 9:33
3 Answers
- Install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Update homebrew if already installed:
brew update
- allow brew to lookup versions
brew tap homebrew/cask-versions
- list available java versions
brew search java
Optional: to find out the minor version of java
brew info --cask java8
- install java 8 (or any other version available)
brew install --cask java8
13 Comments
brew cask install caskroom/versions/java8 First I ran brew cask uninstall java to remove the other version I had previously installed.brew tap homebrew/cask-versions and use brew cask install homebrew/cask-versions/adoptopenjdk8Raising Sean Breckenridge's comment as an answer to increase visibility:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew tap homebrew/cask-versions brew cask install homebrew/cask-versions/adoptopenjdk8 There is no longer cask named "java8".
3 Comments
brew install --cask homebrew/cask-versions/adoptopenjdk8Error: homebrew/cask-versions was deprecated. This tap is now empty and all its contents were either deleted or migrated.run brew update command make sure that brew is update to date.
then check brew by following command... to make sure brew works fine
brew doctor if its has any issue you have to fix that first ...
Then if you want to install specific version run following command ..
brew install java11 in my case it's java11 you can check java available version on java website.
Then go for location
/Library/Java/JavaVirtualMachines/openjdk-11.jdk and make sure jdk file is there...
if there is not any folder just run the following command in terminal...
sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk change the version after @11 according to your required jdk version. its gonna tell system about java runtime.
you can check java version by following command.
java --version