5

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.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Robin K
  • 53
  • 1
  • 4
  • I've got this problem too... although I think all variables change colors properly for me. But I get the same warning in the "Problems" tab with a Java(0) error code, hopefully there's a solution to it. – Togira Apr 15 '22 at 09:13
  • @Steven-MSFT it should pop up if u press the link. PROSA is the name of the folder where i keep my work btw. – Robin K Apr 15 '22 at 10:01

4 Answers4

9

Just a few minutes earlier I was also having the same problem. Here is how I fixed it:

  1. Click on the Gear Icon.
  2. Click on Settings.
  3. Click on Command Palette.
  4. Type Clean java language server workspace.
  5. Hit Restart and Delete.
  6. After reloading is done, the issue will be fixed.
Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Mr. T-REX
  • 124
  • 1
  • 6
4

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.

2

I 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.

Irseq
  • 21
  • 4
1

I have same problems before few minutes ago. and I solved this problem.

File -> Save Workspace AS -> Choose Your directory -> Save