rui*_*ang 8 java visual-studio-code
当我运行 HelloWorld 时,它返回:
“java.lang.UnsupportedClassVersionError:HelloWorld 已由更新版本的 Java 运行时(类文件版本 52.65535)编译,此版本的 Java 运行时仅识别最高版本为 52.0 的类文件”
我该如何解决这个问题?
public class HelloWorld{
public static void main(String[] args) {
System.out.println("123");
}
}
Run Code Online (Sandbox Code Playgroud)
小智 6
该问题与 Java 调试器扩展有关。我遇到了同样的问题,它已记录在问题日志中: https: //github.com/Microsoft/vscode-java-debug/issues/555
\n\n问题仅出现在像 HelloWorld 这样的单文件应用程序上。如果你运行maven项目就可以了。
\n\nMedsonk 的指令对我有用:https://github.com/Microsoft/vscode-java-debug/issues/555#issuecomment-478464496
\n\n\n\n摘要:
\n
\n 1. 确保卸载 jdk8 clean
\n 2. 安装 jdk11
\n 3. 在 launch.json 中添加 "vmArgs": "--enable-preview"
\n 4. F1, "Java: Clean \xe2\ x80\xa6\xe2\x80\xa6" 和 "Java: Force \xe2\x80\xa6\xe2\x80\xa6"
\n 5. 再次运行独立文件
| 归档时间: |
|
| 查看次数: |
9919 次 |
| 最近记录: |