. Advertisement .
..3..
. Advertisement .
..4..
The error: “java is a non-project file, only syntax errors are reported” is a common error that can show up in many ways. In this blog, we will go through some of the ways you can fix this issue. Read on.
Why dose this error happen?
When attempting to execute a Java project in Visual Studio Code, the following warning may appear in your Problem section:
[myfile].java is a non-project file, only syntax errors are reported
You only have to clear the Java language server workspace to fix this error. See the below part to get the detail of suggestion.
How To Solve The Error: “java is a non-project file, only syntax errors are reported”?
Answer 1: For the Java (Maven)
The solution is to have one Java (Maven) project for one workspace, i.e, one Maven project per vscode workspace.
WorkspaceRoot
│ projectA
└───projectB
Answer 2: Clear the Java language server workspace
You only have to clear the Java language server workspace to fix this error. This is the instruction:
- To open the command palette, simply press CTRL+SHIFT+P.
- Then select “Java: Clean the Java Language Server Workspace” from the drop-down menu.
- Restart
- Remove now.
Your message will no longer be shown.
Conclusion
We hope you enjoyed our article about the error. With this knowledge, we know that you can fix your error: “java is a non-project file, only syntax errors are reported” quickly by following these steps! If you still have any other questions about fixing this syntax error, please leave a comment below. Thank you for reading!
Leave a comment