vsCode不显示Java智能感知

huangapple go评论83阅读模式
英文:

vsCode does not show Java intelliSense

问题

我收到了一个新的Amazon Workspaces工作区,并遇到了以下错误:

"无法使用Gradle分发连接运行分阶段构建操作
'https://services.gradle.org/distributions/gradle-6.8-bin.zip'。
Gradle 6.8需要Java 8或更高版本才能运行。您的构建当前
配置为使用Java 7。"

该应用程序可以编译和运行,只是我没有获得智能感知帮助。

当前的Java安装使用:

openjdk 11.0.19 2023-04-18 LTS
OpenJDK Runtime Environment Corretto-11.0.19.7.1 (build 11.0.19+7-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.19.7.1 (build 11.0.19+7-LTS, mixed mode)

build.gradle 文件设置了版本:

sourceCompatibility = '1.11'
targetCompatibility = '1.11'

推荐的Java扩展已安装:Language Support for Java(TM) by Red Hat

我不太确定如何在vsCode中设置Java运行时版本并使其生效。尝试更改设置时,没有设置Java版本(请参见下面的图像)。编辑按钮将我带到设置sourceCompatibilitytargetCompatibilitybuild.gradle文件。

vsCode不显示Java智能感知

有什么建议吗?

英文:

I received a new Amazon Workspaces workspace and have been running into the following error:

"Could not run phased build action using connection to Gradle distribution 
'https://services.gradle.org/distributions/gradle-6.8-bin.zip'.
Gradle 6.8 requires Java 8 or later to run. Your build is currently
 configured to use Java 7."

The app compiles and runs fine, I just get no intelliSense help.

Current Java installation uses:

openjdk 11.0.19 2023-04-18 LTS
OpenJDK Runtime Environment Corretto-11.0.19.7.1 (build 11.0.19+7-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.19.7.1 (build 11.0.19+7-LTS, mixed mode)

The build.gradle file sets the version:

sourceCompatibility = '1.11'
targetCompatibility = '1.11'

The recommended Java extension is installed: Language Support for Java(TM) by Red Hat

I'm not quite sure how to set the java runtime version within vsCode and get it to take. When attempting the change the setting, there is no Java version set (see image below). The edit button takes me to the build.gradle which sets the sourceCompatibility and targetCompatibility.

vsCode不显示Java智能感知

Any suggestions?

答案1

得分: 0

显然,在工作空间上安装了3个版本的Java。找到正确的JVM并设置Gradle守护程序使用它解决了我的所有问题。

英文:

Apparently, 3 versions of Java were installed on the workspace. Finding the correct JVM and setting the Gradle daemon to use it solved all of my issues.

vsCode不显示Java智能感知

huangapple
  • 本文由 发表于 2023年7月13日 23:33:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76681131.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定