Where does Oracle (Sun) install their JDK/JRE on Mac OS X 10.8 Mountain Lion?
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.
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.
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
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
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
then click into JavaVirtualMachines
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
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
I installed it, then selected that one. And it worked
/Library/Java/JavaVirtualMachines/
according to the Mac JDK Uninstall Docs.