'VScode complains that Java project has no explicit encoding set
I have been using vscode with no problems until recently. Now no errors show up, some variables never change color. And I have a constant error message:
Project ... has no explicit encoding set
I have no idea what I need to do to fix it.
Solution 1:[1]
Just a few minutes earlier I was also having the same problem. Here is how I fixed it:
- Click on the Gear Icon.
- Click on Settings.
- Click on Command Palette.
- Type Clean java language server workspace.
- Hit Restart and Delete.
- After reloading is done, the issue will be fixed.
Solution 2:[2]
I believe this is a bug caused by v1.5.0 Red Hat's Language Support for Java extension. Nothing I tried fixed it, so the best solution may be to wait for the extension developers to fix it.
You can follow the issue on GitHub https://github.com/redhat-developer/vscode-java/issues/2416
Update 4/21/2022: Looks like it was caused by an upstream issue in the Eclipse JDT Language Server (which is used by the Visual Studio Code Java extension). Check the GitHub link above for details.
Update 5/13/2022: Upstream issue has finally been resolved and merged. Red Hat's Language Support for Java extension no longer has this bug for me as of v1.6.0.
Solution 3:[3]
I have experienced the same problem after the Language Support for Java by Red Hat extension had been updated to v1.5.0. No code errors were reported and only the message about no explicit encoding was shown in the Problems tab.
I was able to resolve the issue by clicking the "..." next to "Java Projects" in the Explorer view, and selecting "Clean Workspace", then "Restart and delete". After the application had reloaded, the issue was gone and language server started working as usual.
Solution 4:[4]
I have same problems before few minutes ago. and I solved this problem.
File -> Save Workspace AS -> Choose Your directory -> Save
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Stephen Ostermiller |
Solution 2 | |
Solution 3 | Irseq |
Solution 4 | PowerOverWhelmingCoding |