本文翻译自:Installing Java on OS X 10.9 (Mavericks)
I have installed the JDK on Mac OS X v10.8 (Mountain Lion). 我在Mac OS X v10.8 (Mountain Lion)上安装了JDK 。 When I upgraded it to Mac OS X v10.9 (Mavericks) and ran java -version
in the terminal, it showed: 当我将它升级到Mac OS X v10.9 (Mavericks)并在终端中运行java -version
时,它显示:
No Java runtime present, requesting install. 没有Java运行时,请求安装。
Then I manually installed the JDK (1.7) on my Mac. 然后我在Mac上手动安装了JDK(1.7)。 It seems that the installation worked fine. 似乎安装工作正常。 When the installation was done, I opened the terminal and typed java -version
as well. 安装完成后,我打开了终端并输入了java -version
。 It also showed the same error: 它也显示了同样的错误:
No Java runtime present, requesting install. 没有Java运行时,请求安装。
How can I solve this problem? 我怎么解决这个问题?
参考:https://stackoom.com/question/1JxYu/在OS-X-上安装Java-Mavericks
The new Mavericks (10.9) showed me the "Requesting install", but nothing happened. 新的小牛队 (10.9)向我展示了“请求安装”,但没有任何反应。
The solution was to manually download and install the official Java package for OS X, which is in 解决方案是手动下载并安装适用于OS X的官方Java软件包 Java for OS X 2013-005 适用于OS X 2013-005的Java . 。
Update: As mentioned in the comments below, there is a newer version of this same package: 更新:如下面的评论中所述,此相同的软件包有更新版本:
Java for OS X 2014-001 适用于OS X 2014-001的Java
Java for OS X 2014-001 (Correcting dead line above) 适用于OS X 2014-001的Java (纠正上面的死线)
Java for OS X 2014-001 includes installation improvements, and supersedes all previous versions of Java for OS X. This package installs the same version of Java 6 included in Java for OS X 2013-005. 适用于OS X 2014-001的Java包括安装改进,并取代所有以前版本的Java for OS X.此软件包安装了Java for OS X 2013-005中包含的相同版本的Java 6。
没有必要安装JDK,它是开发人员工具包 ,只是安装运行时环境的JRE 。
I downloaded manually to here: Java for OS X 2014-001 . 我手动下载到这里: Java for OS X 2014-001 。
After that open your terminal and check the installation with java -version
. 之后打开终端并使用java -version
检查安装。
EDIT (January, 2015) : Also see HT202912, About Java for OS X 2014-001 : 编辑(2015年1月) :另见HT202912,关于Java for OS X 2014-001 :
The OP implied that Java 7 was the need. OP意味着需要Java 7。 And Java 6 is in fact no longer being 'supported' so 7 is the version you should be installing at this point unless you have legacy app concerns. 事实上,Java 6不再受“支持”,因此除非您有遗留的应用程序问题,否则7应该是您应该安装的版本。
You can get it here: http://java.com/en/download/mac_download.jsp?locale=en 你可以在这里找到它: http : //java.com/en/download/mac_download.jsp?locale = en
If you only want to install the latest official JRE from Oracle, you can get it there, install it, and export the new JAVA_HOME in the terminal. 如果您只想从Oracle安装最新的官方JRE,您可以在那里安装它,安装它,并在终端中导出新的JAVA_HOME。
java -version
gives you an error and a popup java -version
为您提供错误和弹出窗口 export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
在终端中,键入: export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"
java -version
now gives you java version "1.7.0_45"
java -version
现在给你java version "1.7.0_45"
That's the cleanest way I found to install the latest JRE. 这是我发现安装最新JRE最干净的方法。
You can add the export JAVA_HOME
line in your .bashrc
to have java
permanently in your Terminal: 您可以在.bashrc
添加export JAVA_HOME
行,以便永久地在您的终端中使用java
:
echo export JAVA_HOME=\"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home\" >> ~/.bashrc