如何在Mac上安装Java 8 [英] How to install Java 8 on Mac

查看:275
本文介绍了如何在Mac上安装Java 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用最新的JavaFX进行一些编程,这需要Java 8.我使用的是IntelliJ 13 CE和Mac OS X 9 Mavericks。我运行了Oracle的Java 8安装程序,文件看起来就像是在

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

但以前的版本是

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

不确定为什么最新的安装程序将其放入 / Library 而不是 / System / Library (也没有什么区别)。但是 / usr / libexec / java_home 找不到1.8,所以我发现的关于如何设置当前java版本的所有帖子都不起作用。我已经尝试添加一个符号链接,使其看起来像1.8在 / System / Library ... 路径中,但它没有帮助。 / usr / libexec / java_home -V 仍然只列出旧的java 1.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.

具有讽刺意味的是,Java 系统偏好设置下的控制面板仅显示java 1.8!

Ironically, the "Java" control panel under System Preferences shows only java 1.8!

为什么Oracle的安装程序没有将它放在真正的位置?我该如何解决这个问题?

Why doesn't Oracle's installer put it where it really goes? And how can I work around this problem?

推荐答案

不要依赖Oracle在Mac上正确安装Java。

Don't rely on Oracle to install Java properly on your Mac.

使用 Homebrew 。这将安装最新的jdk:

Use Homebrew. this will install the latest jdk:

brew cask install java

如果您想在Mac上管理多个版本的Java,请考虑使用 jenv

If you want to manage multiple versions of Java on your Mac, consider using jenv.

更新:现在Java 8不再是最新版本了,如果你想让java 8以这种方式安装它:

UPDATE: Now that Java 8 is no longer the most current version, if you want java 8 install it this way:

brew tap caskroom/versions
brew cask install java8

获取所有旧版本java的列表: brew tap caskroom / versions 然后使用 brew search java

To get a list of all older versions of java: brew tap caskroom/versions and then use brew search java.

我们使用 brew cask 因为我们否则会使用可能无法在Mac上正确安装Java的Oracle GUI安装程序。 (使用 brew cask安装APP 来安装GUI应用程序;使用 brew install APP 。)Java不是GUI应用程序;它应该不需要桶,但至少Oracle是一致的。

We use brew cask since we'd otherwise use the Oracle GUI installer that will likely not install Java properly on your Mac. (Use brew cask install APP to install GUI apps; use brew install APP.) Java is not a GUI app; It should not require "cask" but at least Oracle is consistent.

这篇关于如何在Mac上安装Java 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆