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 ???
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).
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)
Update
The cited passage disappeared (by 05/18/2021), so lets assume, that VSCode now supports java beyond version 13.
Still (the poularity of) this answer, shows that there is some bug, and ... cleaning the java workspace helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With