Tutorial: How to install Java 8 on Mac
I want to do some programming with the latest JavaFX, which requires Java 8. I’m using IntelliJ 13 CE and Mac OS X 9 Mavericks. I ran Oracle’s Java 8 installer, and the files look like they ended up at
but previous versions are at
Not sure why the latest installer puts this in
/Library instead of
/System/Library (nor what the difference is). But
/usr/libexec/java_home doesn’t find 1.8, so all the posts I’ve found on how to set your current java version don’t work. I’ve tried adding a symbolic link to make it look like 1.8 is in the
/System/Library... path, but it doesn’t help.
/usr/libexec/java_home -V still only lists the old Java 1.6.
Ironically, the “Java” control panel under System Preferences shows only Java 1.8!
Why doesn’t Oracle’s installer put it where it really goes? And how can I work around this problem?
Solutions of How to install Java 8 on Mac
Solution 1: How to install Java 8 on Mac
Oracle has a poor record for making it easy to install and configure Java, but using Homebrew, the latest OpenJDK (Java 14) can be installed with:
brew install --cask adoptopenjdk8
For the many use cases depending on an older version (commonly Java 8), the AdoptOpenJDK project makes it possible with an extra step.
brew tap adoptopenjdk/openjdk brew install --cask adoptopenjdk8
Existing users of Homebrew may encounter
Error: Cask adoptopenjdk8 exists in multiple taps due to prior workarounds with different instructions. This can be solved by fully specifying the location with
brew install --cask adoptopenjdk/openjdk/adoptopenjdk8.
Solution 2: How to install Java 8 on Mac
Note: Oracle Java 8/9/10 is no longer available for public download (license change).
First install and update brew from Terminal:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew tap homebrew/cask-versions brew update
NEW as of June 2019
To install the JDKs from AdoptOpenJDK:
brew tap adoptopenjdk/openjdk brew install --cask adoptopenjdk8 brew install --cask adoptopenjdk9 brew install --cask adoptopenjdk10 brew install --cask adoptopenjdk11
brew install --cask java8
brew install --cask java
Solution 3: How to install Java 8 on Mac
Java8 is no longer available on homebrew,
brew install java8 will not work.
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
See this commit for technical details.
Please note as well you may see issues around
Cask adoptopenjdk8 exists in multiple taps. This is a known issue, currently being worked on, which you can see here:
For those who don’t want to run through the details, here is a summary:
# To install JDK8 brew cask install adoptopenjdk/openjdk/adoptopenjdk8 # To be able to safely run 'brew cleanup' brew untap adoptopenjdk/openjdk brew untap caskroom/versions brew cleanup
Solution 4: How to install Java 8 on Mac
I just did this on my MBP, and had to use
$ brew tap homebrew/cask-versions $ brew cask install java8
in order to get java8 to install.
Solution 5: How to install Java 8 on Mac
Assumption: Mac machine and you already have installed homebrew.
Install cask (with Homebrew 0.9.5 or higher, cask is included so skip this step):
$ brew tap caskroom/cask $ brew tap caskroom/versions
To install latest java:
$ brew cask install java
To install java 8:
$ brew cask install adoptopenjdk/openjdk/adoptopenjdk8
If you want to install/manage multiple version then you can use ‘jenv’:
Install and configure jenv:
$ brew install jenv $ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile $ echo 'eval "$(jenv init -)"' >> ~/.bash_profile $ source ~/.bash_profile
Add the installed java to jenv:
$ jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home $ jenv add /Library/Java/JavaVirtualMachines/jdk1.11.0_2.jdk/Contents/Home
To see all the installed java:
$ jenv versions
The above command will give the list of installed java:
* system (set by /Users/lyncean/.jenv/version) 1.8 188.8.131.52-ea oracle64-184.108.40.206-ea
Configure the java version which you want to use:
$ jenv global oracle64-220.127.116.11
To set JAVA_HOME:
$ jenv enable-plugin export
I hope the How to install Java 8 on Mac solution would be useful for you to learn something new from this solution. If it helped you then don’t forget to bookmark our site for more Quiz Answers and