When i am hitting f5 i get this text in debug window
Error: LinkageError occurred while loading main class Hello
java.lang.UnsupportedClassVersionError: Hello (class file version 52.65535) was compiled with preview features that are unsupported. This version of the Java Runtime only recognizes preview features for class file version 56.65535
javac -version shows
javac 12
java -version
openjdk version "12" 2019-03-19
OpenJDK Runtime Environment AdoptOpenJDK (build 12+33)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 12+33, mixed mode, sharing)
Code that i am trying to compile
public class Hello {
public static void main(String[] agrs)
{
System.out.println("Hello world!");
}
}
PATH,JAVA_HOME and JRE_HOME are set properly. Debug add-on installed. I can compile and run the same code in InteliJ IDEA or using java (file), javac (file) and it will work fine but i don't know why it does not work on vscode.
@JornVernee send link to other question, it helped Link to question
summary:
- make sure uninstall jdk8 clean
- install jdk11
- add "vmArgs": "--enable-preview" in launch.json
- F1, "Java: Clean ……" and "Java: Force ……"
- run standalone file again