英文:
VSCode Unbound classpath container JRE System Library [JavaSE-15]
问题
我一直在使用JDK14和VSCode进行Java项目的编程。最近JDK15已经发布,我切换到了这个JDK版本。关于配置方面,我将VSCode的java.home
和系统的JAVA_HOME
都指向了新的JDK文件夹。
当我清除了VSCode的缓存并重新启动IDE后,我开始收到以下错误:
{
"resource": "/E:/dev/java/challenges/",
"owner": "_generated_diagnostic_collection_name_#3",
"code": "963",
"severity": 8,
"message": "Unbound classpath container: 'JRE System Library [JavaSE-15]' in project 'challenges'",
"source": "Java",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1
}
我已经看过类似的问题和答案,但是没有一个是针对VSCode的。
英文:
I have been programming a java project using JDK14 and VSCode. Recently JDK15 is available, and I switched to the JDK. As for configuration, I pointed the VScode java.home
and system JAVA_HOME
to the new JDK folder.
When I clear the VSCode cache and restart the IDE, I started receiving this error
{
"resource": "/E:/dev/java/challenges/",
"owner": "_generated_diagnostic_collection_name_#3",
"code": "963",
"severity": 8,
"message": "Unbound classpath container: 'JRE System Library [JavaSE-15]' in project 'challenges'",
"source": "Java",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1
}
I have seen similar questions/answers, but none of them was directed to VSCode.
答案1
得分: 3
这个帮助很有用;
替换为:
在POM中构建块为
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
英文:
https://stackoverflow.com/a/42525941/1005462
this one was helpfull;
replace :
build block in POM to
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
答案2
得分: 2
根据 Twitter 上的 VsCode-Java,JDK15 的支持预计要在九月底之前才会发布,这里有一个与 Java 15 不支持相关的 GitHub 问题。
英文:
According to VsCode-Java in Twitter, JDK15 support won't be released until the end of September, and here is a github issue that's related to Java 15 not support.
答案3
得分: 1
我在VSCode中构建Java应用程序还很新。在我的情况下,我正在使用Spring Boot开发微服务。以下是我解决该问题所做的步骤:
- 确保
JAVA_HOME
环境变量注册到正确的路径。 - 在
.vscode
目录下的settings.json
中配置java.jdt.ls.java.home
为 JDK 路径。以下是我的配置示例。
{ "java.configuration.updateBuildConfiguration": "automatic", "java.compile.nullAnalysis.mode": "automatic", "java.jdt.ls.java.home": "/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home" }
- 重新启动 VSCode。
英文:
I am new to building Java apps in VSCode. In my case, I was developing a microservice using Spring Boot. Here is what I've done to solve the issue ;
- Make sure
JAVA_HOME
env variable is registered to the right path - Configured JDK path in
java.jdt.ls.java.home
to settings.json located inside .vscode. Here is my configuration.
<pre>
{
"java.configuration.updateBuildConfiguration": "automatic",
"java.compile.nullAnalysis.mode": "automatic",
"java.jdt.ls.java.home": "/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home"
}
</pre> - Restart the VSCode
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论