I'm able to compile and run my code but there is always an error showing in VSCode. Earlier there was a pop up I don't remember what and I clicked "apply globally" and it's been this way since.
Output is there but so is the error
The declared package "" does not match the expected package
Thanks to the comment of @beatrice above, I found the answer here .
My .vscode\\settings.json
file had some paths explicitly added. I had added them manually when Visual Studio code was not misbehaving, by right-clicking on certain project folders and doing "add Folder to Java source path".
The solution for me was to basically remove all of them from .vscode\\settings.json
, replacing its contents with:
{
"java.project.sourcePaths": [""]
}
This finally made VsCode work again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.