Sunny Raj
Sunny Raj

Reputation: 15

Why I'm getting a Java classpath not found Error in VS Code

I don't know why I'm getting a classpath not found error in VS Code when I open more than one java program in the same workspace. Also sometimes this error shows up even when I open a single project and run the program. Is there any solution for this problem?

Upvotes: 0

Views: 2143

Answers (1)

Molly Wang-MSFT
Molly Wang-MSFT

Reputation: 9461

Usually it can be fixed by right clicking the project and choosing Add Folder to Java Source Path, after that, it may throw another error:

enter image description here

Click Quick Fix and add package declaration, you can run .java file successfully:

enter image description here

Upvotes: 2

Related Questions