Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Java 8 on Mac

Editors note: This question was asked in 2014, and the answers may be outdated.


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

/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk 

but previous versions are at

/System/Library/Java/JavaFrameworks/jdk1.6.... 

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?

like image 754
user3763100 Avatar asked Jun 21 '14 15:06

user3763100


People also ask

Where is JDK 8 installed Mac?

In macOS, the JDK installation path is /Library/Java/JavaVirtualMachines/jdk-10. jdk/Contents/Home . The root directory of the JDK software installation.

How do I know if I have Java 8 installed on my Mac?

Type terminal in the search bar and open it by clicking on the icon in the search results. 3. Once in the command line, run the command: java -version . The output should display the Java version installed on your MacOS.


1 Answers

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.

like image 195
l3x Avatar answered Sep 28 '22 07:09

l3x