我在Mac M2架构上运行IntelliJ。我最初从Adopt Open JDK下载了JDK 17,并创建了一个简单的Kotlin项目,该项目从IDE中提供的示例代码打印“hello world”,如下所示:
然而,当我尝试构建这个简单的hello world项目时,我得到了这个错误消息:
Failed to calculate the value of task ':compileJava' property 'javaCompiler'.
Unable to download toolchain matching these requirements: {languageVersion=8, vendor=any, implementation=vendor-specific}
Unable to download toolchain. This might indicate that the combination (version, architecture, release/early access, ...) for the requested JDK is not available.
Could not read 'https://api.adoptopenjdk.net/v3/binary/latest/8/ga/mac/aarch64/jdk/hotspot/normal/adoptopenjdk' as it does not exist.
当我复制并粘贴URL时,错误消息肯定是正确的:
https://api.adoptopenjdk.net/v3/binary/latest/8/ga/mac/aarch64/jdk/hotspot/normal/adoptopenjdk
并放入Web浏览器中,该网站不存在。因此,IntelliJ无法读取该网站是有道理的。
所以我下载了Oracle JDK 17 for M2 Apple,并指向IntelliJ项目查看它的安装位置,如下所示:
然而,IntelliJ似乎坚持使用Adopt Open JDK,尽管我告诉它使用Oracle JDK 17。我如何让IntelliJ使用Oracle JDK并寻找Adopt JDK?
1条答案
按热度按时间pdkcd3nj1#
是known issue
解决方案是更新到IntelliJ IDEA 2023+(当前为available as RC)或将
build.gradle.kts
中的jvmToolchain(8)
更改为jvmToolchain(11)
。