Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
229 views
in Technique[技术] by (71.8m points)

java - 如何在Mac上安装Java 8(How to install Java 8 on Mac)

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.

(我想使用需要Java 8的最新JavaFX进行一些编程。我正在使用IntelliJ 13 CE和Mac OS X 9 Mavericks。)

I ran Oracle's Java 8 installer, and the files look like they ended up at

(我运行了Oracle的Java 8安装程序,文件看起来像最终在)

/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk

but previous versions are at

(但以前的版本在)

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

Not sure why the latest installer puts this in /Library instead of /System/Library (nor what the difference is).

(不知道为什么最新的安装程序会将它放在/Library而不是/System/Library (也不会有什么区别)。)

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.

(但是/usr/libexec/java_home找不到1.8,所以我找到的有关如何设置当前Java版本的所有帖子都不起作用。)

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.

(我尝试添加一个符号链接,使其看起来像/System/Library...路径中的1.8,但它没有帮助。)

/usr/libexec/java_home -V still only lists the old Java 1.6.

(/usr/libexec/java_home -V仍然仅列出旧的Java 1.6。)

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

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

Why doesn't Oracle's installer put it where it really goes?

(为什么Oracle的安装程序没有将它放到真正的位置?)

And how can I work around this problem?

(我该如何解决这个问题?)

  ask by user3763100 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Oracle has a poor record for making it easy to install and configure Java, but using Homebrew , the latest OpenJDK (Java 13) can be installed with:

(Oracle在简化安装和配置Java方面的记录很差,但是使用Homebrew可以将最新的OpenJDK(Java 13)安装在:)

brew cask install java

For the many use cases depending on an older version (commonly Java 8), the AdoptOpenJDK project makes it possible with an extra step.

(对于依赖于较旧版本(通常为Java 8)的许多用例, AdoptOpenJDK项目通过额外的步骤即可实现。)

brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk8

Existing users of Homebrew may encounter Error: Cask adoptopenjdk8 exists in multiple taps due to prior workarounds with different instructions.

(现有的Homebrew用户可能会遇到Error: Cask adoptopenjdk8 exists in multiple taps由于先前使用不同指令的解决方法,因此Error: Cask adoptopenjdk8 exists in multiple taps 。)

This can be solved by fully specifying the location with brew cask install adoptopenjdk/openjdk/adoptopenjdk8 .

(这可以通过使用brew cask install adoptopenjdk/openjdk/adoptopenjdk8完全指定位置来解决。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...