在Visual Studio代码中,我使用Debugger for Java扩展。尝试使用Java扩展进行调试时遇到问题。
PS C:\Users\Utilisateur\Desktop\lab10> javac -version
javac 1.8.0_201
PS C:\Users\Utilisateur\Desktop\lab10> java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
这是我班上的代码:
public class Test{
public static void main(String[] args){
int a = 123;
System.out.println(a);
}
}
运行文件时,一切正常:
PS C:\Users\Utilisateur\Desktop\qwer> java Test
123
但是当我尝试调试时(Microsoft的Java调试器)。我在调试控制台中收到此错误消息:
java.lang.UnsupportedClassVersionError: Test 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
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
我期待着这些答案https://stackoverflow.com/a/11432195/7211346 它对我不起作用