问题
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:
ctrl + shift + p.
Write to the command palette: Clean the Java language server workspace.
Press enter (restart your VScode).
来源:https://stackoverflow.com/questions/60994004/preview-features-enabled-at-an-invalid-source-release-level-13-preview-can-be-e