问题
当我运行 HelloWorld 时,它返回:
"java.lang.UnsupportedClassVersionError: HelloWorld has been compiled by a more recent version of the Java Runtime (class file version 52.65535), this version of the Java Runtime only recognizes class file versions up to 52.0 "
我该如何解决这个问题?
截图
代码
public class HelloWorld{
public static void main(String[] args) {
System.out.println("123");
}
}
最佳答案
此问题与 Java 调试器扩展有关。我有同样的问题,它已记录在问题日志中:https://github.com/Microsoft/vscode-java-debug/issues/555
问题仅出在像 HelloWorld 这样的单文件应用程序中。运行maven项目就ok了。
Medsonk 的指导对我有用:https://github.com/Microsoft/vscode-java-debug/issues/555#issuecomment-478464496
summary:
1. make sure uninstall jdk8 clean
2. install jdk11
3. add "vmArgs": "--enable-preview" in launch.json
4. F1, "Java: Clean ……" and "Java: Force ……"
5. run standalone file again
关于java - 如何解决 VScode UnsupportedClassVersionError?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55443351/