我在使用 IntelliJ 时遇到了这个问题,但是我的系统上已经安装了最新版本的所有软件。
... 已经由 Java 运行时的最新版本(类文件版本57.0)编译,这个版本的 Java 运行时只能识别到52.0的类文件版本
我已经设置好了:
PATH as C:\Program Files\Java\jdk-13 JAVA _ HOME as: C: Program Files JAVA jdk-13 JRE_HOME as: C:\Program Files\Java\jre1.8.0_221
我已经设置了路径,试图在项目结构中找到一个变化
完整错误信息:
H:\087-JAVA\HelloWorld\src>java com.codewithmosh.Main
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/codewithmosh/Main has been compiled by a more recent version of the Java Runtime (class file version 57.0), 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(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)