Abdelrahmane Khaldi
Abdelrahmane Khaldi

Reputation: 87

Java Error Vs code: (class_Name).java is a non-project file, only syntax errors are reported

this error keeps showing while I run any java program on vs code, the program gets executed with no problem but the error keeps showing

Upvotes: 0

Views: 8240

Answers (2)

Suchint
Suchint

Reputation: 589

You need to right-click on the parent folder of the file you are working on in your current workspace and then click on "Add Folder To Java Source Path" enter image description here

Upvotes: 2

MingJie-MSFT
MingJie-MSFT

Reputation: 9209

The method of opening file is wrong. The problem is that a single file cannot be recognized as a project. The correct way to open a java file is to open folder first and then the file.

Upvotes: 2

Related Questions