"Classpath is incomplete. Only syntax errors will be reported" 在 VSCode 中 Java 播放 Eclipse 项目
"Classpath is incomplete. Only syntax errors will be reported" in VSCode with Java Play Eclipse Project
首先:我在这个错误中找到的每个答案都是关于一个完整项目之外的 Java 文件,这在这里不适用。
我正试图回到我的一个旧 java 游戏项目,游戏 2.6。我用 sbt eclipse
命令 "Eclipsified" 它。它写于 Java 8.
这很可能是 VSCode 配置问题,因为 sbt compile
在此项目上运行顺利,java 播放应用程序运行且一切正常。
我的系统在全球范围内使用 OpenJDK 1.8。我的 OS 是 Ubuntu 18.04.
我的问题:
在我的代码中的某些时候,我有这些行:
import java.util.concurrent.CompletableFuture;
// some more code
return CompletableFuture.supplyAsync(() -> forbidden());
而 VSCode 给我这个错误:
The method supplyAsync(Supplier) in the type CompletableFuture is not applicable for the arguments (() -> {})Java(67108979)
另外,当我打开项目中的任何 Java 文件时,我收到以下错误:
Classpath is incomplete. Only syntax errors will be reported
但是在我的项目中我有以下 Eclipse 文件
.classpath
.project
.settings/org.eclipse.core.resources.prefs
.settings/org.scala-ide.sdt.core.prefs
我的class路径包括但不限于(full classpath file here):
<classpathentry kind="src" path="app"/>
<classpathentry kind="src" path="conf"/>
<classpathentry kind="src" path="target/scala-2.12/twirl/main"/>
<classpathentry kind="src" path="target/scala-2.12/routes/main"/>
(我所有的源代码都在app
)
在我相对于 Java 的 VSCode 设置中,我有:
"java.home": "/usr/lib/jvm/java-1.8.0-openjdk-amd64",
"java.configuration.updateBuildConfiguration": "interactive",
"java.format.comments.enabled": false,
"java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml"
注意:这里指出的参数错误只是一个例子,我还有其他的比如:
return CompletableFuture.completedFuture(Optional
.ofNullable((Subject) ctx.args.get(ConfigKeys.SOME_CONFIG_KEY)));
告诉我:
The method ofNullable(T) in the type Optional is not applicable for the arguments (Subject)Java(67108979)
我很确定这是因为我的 VSCode 编辑器配置不当,因为我上次处理这个项目时它也是 VSCode 而我没有遇到这种问题。
问题已解决:VSCode 中的 sbt
扩展引起了一些干扰。
首先:我在这个错误中找到的每个答案都是关于一个完整项目之外的 Java 文件,这在这里不适用。
我正试图回到我的一个旧 java 游戏项目,游戏 2.6。我用 sbt eclipse
命令 "Eclipsified" 它。它写于 Java 8.
这很可能是 VSCode 配置问题,因为 sbt compile
在此项目上运行顺利,java 播放应用程序运行且一切正常。
我的系统在全球范围内使用 OpenJDK 1.8。我的 OS 是 Ubuntu 18.04.
我的问题:
在我的代码中的某些时候,我有这些行:
import java.util.concurrent.CompletableFuture;
// some more code
return CompletableFuture.supplyAsync(() -> forbidden());
而 VSCode 给我这个错误:
The method supplyAsync(Supplier) in the type CompletableFuture is not applicable for the arguments (() -> {})Java(67108979)
另外,当我打开项目中的任何 Java 文件时,我收到以下错误:
Classpath is incomplete. Only syntax errors will be reported
但是在我的项目中我有以下 Eclipse 文件
.classpath
.project
.settings/org.eclipse.core.resources.prefs
.settings/org.scala-ide.sdt.core.prefs
我的class路径包括但不限于(full classpath file here):
<classpathentry kind="src" path="app"/>
<classpathentry kind="src" path="conf"/>
<classpathentry kind="src" path="target/scala-2.12/twirl/main"/>
<classpathentry kind="src" path="target/scala-2.12/routes/main"/>
(我所有的源代码都在app
)
在我相对于 Java 的 VSCode 设置中,我有:
"java.home": "/usr/lib/jvm/java-1.8.0-openjdk-amd64",
"java.configuration.updateBuildConfiguration": "interactive",
"java.format.comments.enabled": false,
"java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml"
注意:这里指出的参数错误只是一个例子,我还有其他的比如:
return CompletableFuture.completedFuture(Optional
.ofNullable((Subject) ctx.args.get(ConfigKeys.SOME_CONFIG_KEY)));
告诉我:
The method ofNullable(T) in the type Optional is not applicable for the arguments (Subject)Java(67108979)
我很确定这是因为我的 VSCode 编辑器配置不当,因为我上次处理这个项目时它也是 VSCode 而我没有遇到这种问题。
问题已解决:VSCode 中的 sbt
扩展引起了一些干扰。