简体   繁体   English

Mac OS X 10.8 Mountain Lion上安装了Oracle(Sun)的JDK / JRE在哪里?

[英]Where is Oracle's (Sun's) JDK/JRE installed on Mac OS X 10.8 Mountain Lion?

Oracle(Sun)在Mac OS X 10.8 Mountain Lion上安装JDK / JRE的位置是什么?

/Library/Java/JavaVirtualMachines/根据Mac JDK卸载文档

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

install here on Maverick at least: 至少在Maverick上安装:

/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. 这个JRE完全独立于Apple已安装的JRE,它们位于/System/Library/Frameworks/JavaVM.framework/Versions/之下,作为另一个提到的答案。

如果在Eclipse之类的东西中设置JRE路径,则需要指向/ home目录,即

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

On my system, evaluating which java leads me to /usr/bin/java . 在我的系统上,评估which java引导我/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. 如果它是相关的, java -version告诉我我已经安装了1.6.0_37

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. 其他一些答案可能是正确的,但在办公室的新计算机上安装时,这对我有用(截至2016年1月是最新的)。

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". 然而,这是一个到达那里的视觉指南,因为你可以找到许多名为“Library”的目录。 Make sure you are here 确保你在这里

在此输入图像描述


then click into JavaVirtualMachines 然后单击进入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 如果您正在进行新的设置并刚刚下载了Android工作室,他们可能会将您发送到“下载Java for OS X 2015-001”, 网址https://support.apple.com/kb/dl1572?locale=en_US
That gives you version 1.6.0 这给你1.6.0版

在此输入图像描述

That won't work!!!! 那不行!!!!

I got the error that I needed JDK 7.0 or newer. 我得到了错误,我需要JDK 7.0或更新版本。

I looked for a newer version and found this link from Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 我找了一个更新的版本,发现这个链接来自Oracle http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

在此输入图像描述


I installed it, then selected that one. 我安装了它,然后选择了那个。 And it worked 它奏效了

在此输入图像描述

The JDK/JRE as mentioned in previous answers is located in /Library/Java/JavaVirtualMachines/<version>/Contents/Home/. 前面的答案中提到的JDK / JRE位于/ Library / Java / JavaVirtualMachines / <version> / Contents / Home /中。 The JRE is dir under this Home. JRE是这个家庭的目录。 Interestingly browsers doesn't use files from this location for java applet plugin. 有趣的是,浏览器不会将此位置的文件用于Java applet插件。 The location used by browsers is /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/. 浏览器使用的位置是/ 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. 实际上,如果您运行JRE安装程序,它将更新此位置中的文件而不是JDK / JRE位置。

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. 你看/Library/Java/JavaVirtualMachines/是你需要查看的地方。

And /Library/Java/JavaVirtualMachines/jdk<version>.jdk/Contents/Home/ is your JAVA_HOME /Library/Java/JavaVirtualMachines/jdk<version>.jdk/Contents/Home/是你的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

The version 8 release from Oracle (1.8.0_40-b25) can be found at: Oracle的版本8发行版(1.8.0_40-b25)可在以下位置找到:

/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. 仅供参考:Oracle不遵循使/ Library / Java / Current(etc)链接到最新安装的java的做法。

Below is my method of keeping up with versions over time: from my .zshrc file: 以下是我随时间跟上版本的方法:来自我的.zshrc文件:

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 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM