Java IntelliJ IDEA 添加 JDK 10:“所选目录不是 JDK 的有效主目录”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50699972/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 23:46:05  来源:igfitidea点击:

IntelliJ IDEA adding JDK 10: “The selected directory is not a valid home for JDK”

javamacosintellij-ideajava-10

提问by Anders Rabo Thorbeck

I'm creating this question only because the duplicate questions I found were marked with Windowsand Ubunturespectively, whereas I am experiencing this issue on macOS

我创建这个问题只是因为我发现的重复问题分别标有WindowsUbuntu,而我在 macOS 上遇到了这个问题

I have IntelliJ Ultimate 2017.2 installed, with JDK 8 added, and want to add JDK 10. After downloading and installing Oracle's JDK 10, and attempting to add /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Homeas a new JDK to IntelliJ, I got the error message

我安装了 IntelliJ Ultimate 2017.2,添加了 JDK 8,并想添加 JDK 10。下载并安装 Oracle 的 JDK 10,并尝试将/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home新 JDK添加为 IntelliJ 后,我收到错误消息

The selected directory is not a valid home for JDK

所选目录不是 JDK 的有效主目录

despite the fact that the path and file permissions of this JDK 10 directory were seemingly all aligned with the JDK 8 ones.

尽管这个 JDK 10 目录的路径和文件权限似乎都与 JDK 8 一致。

采纳答案by Anders Rabo Thorbeck

It turned out that upgrading to the newest IntelliJ IDEAversion was (for some reason) what was required. After installing IDEA 2018.1, I was able to add JDK 10 without issue.

事实证明,升级到最新的 IntelliJ IDEA版本是(出于某种原因)所需要的。安装 IDEA 2018.1 后,我可以毫无问题地添加 JDK 10。