(类文件版本 53.0),Java 运行时版本高达 52.0 Visual Studio 代码 [英] (class file version 53.0), Java Runtime versions up to 52.0 Visual studio code

查看:20
本文介绍了(类文件版本 53.0),Java 运行时版本高达 52.0 Visual Studio 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Visual Studio 代码用于 Java.

I'm trying to use visual studio code for Java.

已经安装了 Java 扩展,并安装了 1.8 JDK,环境变量指向安装.

Have installed the extensions for Java, and have a 1.8 JDK installed with environment variable pointing to the install.

使用简单的 hello world 程序启动调试器时,我得到以下信息:

When starting debugger with a simple hello world program, I get the following:

java.lang.UnsupportedClassVersionError:HelloWorld 已被更新版本的 Java Runtime(类文件版本 53.0)编译,此版本的 Java Runtime 仅识别最高 52.0 的类文件版本在 java.lang.ClassLoader.defineClass1(Native Method)............在 sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

java.lang.UnsupportedClassVersionError: HelloWorld has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) ...... ...... at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)

感谢在 Visual Studio 代码中进行 Java 调试的任何帮助.

Any help with getting Java debugging in Visual Studio code appreciated.

推荐答案

您可能正在使用 Java 9 进行编译(或使用已编译的依赖项),但仍在使用 JDK 8.0

You are probably compiling (or using dependencies compiled) with java 9, but still using JDK 8.0

安装 java 9 并更改您的操作系统环境设置以指向新的 JDK.这应该可以解决您的问题.

Install java 9 and change your OS environment settings to point to the new JDK. This should solve your problem.

这篇关于(类文件版本 53.0),Java 运行时版本高达 52.0 Visual Studio 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆