Java-VSCode error:Cannot resolve the modulepaths/classpaths automatically, please specify the value in the launch.json

Viewed 3764

first of all I read all the questions about the problem, but I could not find the answer.

The compiler sent me an error "Cannot resolve the modulepaths/classpaths automatically, please specify the value in the launch.json."but i don't know how i will solve this problem. Is there any know how i solve this?

4 Answers

Running "Clean Java Language Server Workspace" command helped me.

enter image description here

In project's folder create folder named ".vscode" with "settings.json" file inside including:

{ "java.project.sourcePaths": [ "src" ] }

Check the source path. Run the code and check for source path location. The code's source path was not like the previous main one.

OK, so I had this issue, despite cleaning the workspace, and ensuring that all the source paths were set correctly etc. Nothing I did would work, nor was there anything wrong with my project setup (I was using Gradle in this case).

The final act was to simply delete the whole project folder and re-clone it from my Git repo, and magically the error went away and I was able to run / debug my code. Very strange, but something somewhere was being cached that was causing this problem.

Related