49

Where does Oracle (Sun) install their JDK/JRE on Mac OS X 10.8 Mountain Lion?

Heath Borders
  • 30,998
  • 16
  • 147
  • 256

8 Answers8

53

/Library/Java/JavaVirtualMachines/ according to the Mac JDK Uninstall Docs.

Heath Borders
  • 30,998
  • 16
  • 147
  • 256
  • 2
    Are you running JDK 1.7 on Mountain Lion? – Heath Borders Dec 17 '12 at 17:37
  • I see I got 1.4, 1.5 and 1.6 but no 1.7 – Aviram Segal Dec 17 '12 at 17:42
  • 1
    @AviramSegal: you've probably installed Java for OS X, which built and distributed by Apple, not the Oracle JRE/JDK. – Bradley T. Hughes Dec 17 '12 at 19:04
  • 10
    Only true for the JDK, the JRE is at `/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/` as http://stackoverflow.com/a/21068094/461597 pointed out. – Unapiedra Mar 14 '14 at 13:59
  • 1
    You can also try `$(/usr/libexec/java_home)` which will dynamically find the path to your java installation. source: https://www.baeldung.com/java-home-on-windows-7-8-10-mac-os-x-linux –  May 21 '19 at 20:40
14

The Oracle Java SE downloads at: http://www.oracle.com/technetwork/java/javase/overview/index.html

install here on Maverick at least:

/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/

this JRE is entirely separate from the ones that Apple has installed, which are under /System/Library/Frameworks/JavaVM.framework/Versions/ as another answer mentioned.

zzzeek
  • 72,307
  • 23
  • 193
  • 185
9

If you setting the JRE path in something like Eclipse you'll need to point to the /home directory i.e

/Library/Java/JavaVirtualMachines/<Replace with version>/Contents/Home

scottyab
  • 23,621
  • 16
  • 94
  • 105
8

Some of the other answers might be correct but this is what worked for me (which is different and up to date as of January 2016) when installing it on a new computer at the office.

The path as mentioned in another answer is

/Library/Java/JavaVirtualMachines/<Replace with version>/Contents/Home

Here however is a visual guide to getting there, because you can find many directories named "Library". Make sure you are here

enter image description here


then click into JavaVirtualMachines

enter image description here


If you are doing a new setup and just downloaded Android studio, they might have sent you to "Download Java for OS X 2015-001" at https://support.apple.com/kb/dl1572?locale=en_US
That gives you version 1.6.0

enter image description here

That won't work!!!!

I got the error that I needed JDK 7.0 or newer.

I looked for a newer version and found this link from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

enter image description here


I installed it, then selected that one. And it worked

enter image description here

JGallardo
  • 11,074
  • 10
  • 82
  • 96
7

On my system, evaluating which java leads me to /usr/bin/java. This in turn is a symlink to:

/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

In case it's relevant, java -version tells me I have 1.6.0_37 installed.

Mike Kwan
  • 24,123
  • 12
  • 63
  • 96
  • I have the same behavior. I'm trying to figure out how to go from the command `java` to the actual executable. I can find `/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java` the same way you did, but it is just an executable, not a symlink. – Heath Borders Dec 17 '12 at 17:39
  • 1
    FYI, the Apple distributed Java for OS X ends up in /System/Library/Java – Bradley T. Hughes Dec 17 '12 at 19:03
1

The JDK/JRE as mentioned in previous answers is located in /Library/Java/JavaVirtualMachines/<version>/Contents/Home/. The JRE is dir under this Home. Interestingly browsers doesn't use files from this location for java applet plugin. The location used by browsers is /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/. In fact if you run JRE installer, it updates the files in this location rather than JDK/JRE location.

Umesh W
  • 41
  • 5
0

Enough answers here, but I'm JUST adding a way to find it by yourself

$ sudo find / -name Java
/Library/Application Support/Oracle/Java
/Library/Java
/private/var/root/Library/Application Support/Oracle/Java
/System/Library/Java
/Users/prayagupd/Library/Application Support/Oracle/Java

To be more specific,

$ sudo find / -name jdk*
/Applications/Android Studio.app/Contents/jre/jdk
/Applications/Android Studio.app/Contents/lib/jdkAnnotations.jar
/Applications/IntelliJ IDEA.app/Contents/jre/jdk
/Applications/IntelliJ IDEA.app/Contents/lib/jdkAnnotations.jar
/Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk

You see /Library/Java/JavaVirtualMachines/ is the place you need to look inside.

And /Library/Java/JavaVirtualMachines/jdk<version>.jdk/Contents/Home/ is your JAVA_HOME

$ ls -ls /Library/Java/JavaVirtualMachines/jdk1.7.0_76.jdk/Contents/Home/
total 39776
    8 -rw-rw-r--   1 root  wheel      3339 Dec 18  2014 COPYRIGHT
    8 -rw-rw-r--   1 root  wheel        40 Dec 18  2014 LICENSE
    8 -rw-rw-r--   1 root  wheel       114 Dec 18  2014 README.html
  216 -rw-rw-r--   1 root  wheel    110114 Dec 17  2014 THIRDPARTYLICENSEREADME-JAVAFX.txt
  344 -rw-rw-r--   1 root  wheel    173559 Dec 18  2014 THIRDPARTYLICENSEREADME.txt
    0 drwxrwxr-x  44 root  wheel      1496 Feb 28 20:13 bin
    0 drwxrwxr-x   9 root  wheel       306 Feb 28 20:13 db
    0 drwxrwxr-x   9 root  wheel       306 Feb 28 20:13 include
    0 drwxrwxr-x  10 root  wheel       340 Feb 28 20:13 jre
    0 drwxrwxr-x  14 root  wheel       476 Feb 28 20:13 lib
    0 drwxrwxr-x   5 root  wheel       170 Dec 18  2014 man
    8 -rw-rw-r--   1 root  wheel       502 Dec 18  2014 release
39184 -rw-rw-r--   1 root  wheel  20061067 Dec 18  2014 src.zip
prayagupa
  • 30,204
  • 14
  • 155
  • 192
-2

The version 8 release from Oracle (1.8.0_40-b25) can be found at:

/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java

FYI: Oracle is not following the practice of making /Library/Java/Current (etc) a link to the latest installed java.

Below is my method of keeping up with versions over time: from my .zshrc file:

108 JAVA_6_HOME=/System/Library/Frameworks/JavaVM.framework/Home
109 JAVA_7_HOME=/Library/Java/Current
110 JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
111 
112 export JAVA_6_HOME
113 export JAVA_7_HOME
114 export JAVA_8_HOME
115 
116 export JAVA_HOME=$JAVA_8_HOME
117 
118 PATH=$PATH:$JAVA_HOME/bin
119