Preview features enabled at an invalid source release level 13, preview can be enabled only at source level 14Java(2098258)

天涯浪子 提交于 2020-12-26 04:30:14

问题


VS Code is showing anomalous behaviour from into my pc from the last couple of days. I am not able to run a simple java code. At the beginning it's it's giving an error:

> Preview features enabled at an invalid source release level 13, preview can be enabled only at source level 14Java(2098258)

The compilation result ends with: `

Error: Could not find or load main class Lol Caused by: java.lang.ClassNotFoundException: Lol

Lol is the class name in which I have defined the main method.

class Lol
{
  public static void main(String args[])
  {
    System.out.println("write the String");
  }
}

Every time I am stating a new project it's showing me the exact same result and end up giving this error for all the current and previously build java codes.

I have installed jdk14 into my pc and added the path properly to after reading some solution on stackoverflow. But this does not help at all.

Can Anybody tell me where the problem is exactly ???


回答1:


Visual Studio Code works with all major Java versions from various vendors up to 13.

Source: https://code.visualstudio.com/docs/languages/java (OP date)




回答2:


I had the same issue and what I did: I simply cleaned the Java language server workspace, which can be achieved by doing 3 simple steps:

  1. ctrl + shift + p.

  2. Write to the command palette: Clean the Java language server workspace.

  3. Press enter (restart your VScode).



来源:https://stackoverflow.com/questions/60994004/preview-features-enabled-at-an-invalid-source-release-level-13-preview-can-be-e

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!