Warning: Classpath is incomplete. Only syntax errors will be reported.
I set java.home to "/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home", when I open a java file, the vscode shows the warning message "Classpath is incomplete. Only syntax errors will be reported.", what's wrong? How can I fix this issue?
This warning message is from this file: https://github.com/gorkem/java-language-server/blob/74efc7ac1d9c9abb6728864111e33b1eb4d5e483/org.jboss.tools.vscode.java/src/org/jboss/tools/vscode/java/internal/handlers/DocumentLifeCycleHandler.java#L114
Environment
- Operating System: macOS Sierra 10.12.1
- JDK version: 1.8.0_102
- Visual Studio Code version: 1.7.2
- Java extension version: 1.8.0_102
Steps To Reproduce
- on
settings.jsonfile, setjava.hometo"/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home" - reload window
- open a java file
In VS Code just right-click on the src (the folder which contains .java files) folder and select the " Add folder to Java source path" option. If it didn't' worked, then try to remove it first by selecting "remove the folder from Java source path" and then adding it again.
Restart once when done. Hope it works for you.
This warning is displayed when you open a single java file, because at that point, no classpath can be configured thus no information on types other than the default JDK can be provided. In that case, only syntax errors are reported. Else you'd get compilation errors all over the place. Javadoc and Navigation to classes from the JDK are available.
You need to open a folder containing a pom.xml, or at least default eclipse setting files, so that a complete classpath and project hierarchy can be set.
I cannot find the pom.xml file, can u please tell me where it is? My jdk is currently 16.0.1 version.