How to install Java 9 and 10 on Mac with Homebrew?
Solution 1
Oracle does not support Java 9 and Java 10 releases. users are advised to use Java 11 instead. Brew removed casks for both releases as well.
Here are the official links from oracle which mention that they removed support for Java 9 and Java 10.
https://www.oracle.com/technetwork/java/javase/downloads/jdk9-downloads-3848520.html https://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html
When you will do brew cask install java
it will install the latest version while you can still install java 8 by using brew cask install java8
Below github link from homebrew clearly mentioned that when oracle stops supporting java10 then they will remove java10 cask.
https://github.com/Homebrew/homebrew-cask-versions/pull/6305
Summary
Java 9
and Java 10
were non LTS(Long time support) releases from oracle and according to new release pattern from oracle, they will stop supporting non LTS release as soon as new version released thus Java 9 lost its support when 10 was released and Java 10 lost its support when 11 was released but Java 8 and Java 11 are LTS release so oracle will support it for long time.
Oracle stops supporting means download for those versions are not publicly available.
Solution 2
Those Oracle JDKs are no longer supported, and Homebrew core does not publish formulae for unsupported software.
Do you specifically need Oracle's JDK, or can you use any JDK? The AdoptOpenJDK JDKs are still available, and they're built from the same codebase as Oracle's JDK; just packaged differently. They do the same things as Oracle's JDK, pretty much. And they're still supported.
And as of Java 11, you may well need to switch from Oracle to OpenJDK, because Oracle has ended the free licensing of the JDK.
To install the JDKs from AdoptOpenJDK:
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk9
brew cask install adoptopenjdk10
brew cask install adoptopenjdk11
Solution 3
As of 2021, you should run
brew tap adoptopenjdk/openjdk
brew install --cask adoptopenjdk9
to make it work
Related videos on Youtube
Alexander Mills
Dev, Devops, soccer coach. https://www.github.com/oresoftware
Updated on July 09, 2022Comments
-
Alexander Mills almost 2 years
I tried to install Java 9 and 10 on macOS with Homebrew:
brew cask install java9
I got the following error:
Error: Cask 'java9' is unavailable: No Cask with this name exists.
and:
brew cask install caskroom/versions/java9
gave me:
Error: Cask 'java9' is unavailable:
'/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions/Casks/java9.rb' does not exist.
Why doesn't this work and how can I install Java on macOS?
-
Ashvin solanki about 5 yearsthis may helps you....tecadmin.net/install-java-macos
-
Alexander Mills about 5 yearsyeah I tried that, I can install Java 11 but not Java 9 or 10 :/
-
Darren Forsythe about 5 yearssdkman.io is an alternative to handling things like java which does have older SDKs on it. Can also switch between 8/9/10/11 etc. and install your own versions of software into it to handle the swtiching also.
-
-
Alexander Mills about 5 yearshmmm I wonder how you do library development and easily test with Java9 or Java10 or what not?
-
Jainik about 5 yearsJava 9 and Java 10 were non LTS(Long time support) releases from oracle and according to new release cycles from oracle, they will stop supporting non LTS release as soon as new version released thus Java 9 lost its support when 10 was released and Java 10 lost its support when 11 was released but Java 8 and Java 11 are LTS release so oracle will support it for long time.
-
mmccabe about 5 years@andrew-janke answer to this question worked for me: stackoverflow.com/a/55775518/1420881
-
IgorGanapolsky over 4 yearsMy Mac still keeps Oracle's Jdk 12, and refuses to recognize what Homebrew installed.
-
Andrew Janke over 4 yearsIf you have multiple JDKs installed, then the Java shims from macOS will typicall choose the newest one you have installed, so JDK 12 will be the default over JDK 9, 10, or 11. If you want to use the older ones, either uninstall JDK 12, set the
$JAVA_HOME
environment variable, or modify your Java invocations to use version options with/usr/libexec/java_home
. -
David Raviv over 4 yearsAfter installing the latest java version (in my case 13.0.1) I got an authentication issue from macos. Solved it this way: apple.stackexchange.com/questions/372744/…
-
Charlie 木匠 over 3 yearsbrew cask install adoptopenjdk #. this works as well.
-
Rick Hanton over 2 yearsNowadays, you can leave out the "cask" bit and just perform commands like
brew install adoptopenjdk9
to perform the install of JDK 9 -
Andrew Janke over 2 yearsThanks Rick! I'll update my answer once I have a chance to test this out.