该类已由Java Runtime的较新版本编译

时间:2019-05-09 19:36:13

标签: java compiler-errors compilation java-native-interface

所以我有一个项目,要求我用Java创建程序。由于我们是该语言的新手,所以老师建议我们用Notepad ++编写代码,然后键入“ javac Filename.java”和“ java Filename”来运行它。问题是即使编译成功,当我实际尝试运行程序时,也会发生以下错误:

Error: A JNI error has occurred, please check your installation and try
again
Exception in thread "main" java.lang.UnsupportedClassVersionError:         Products has been compiled by a more recent version of the Java Runtime (class file version 55.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)

即使我和我的一个朋友具有相同版本的JDK(11.0.2),我的程序似乎仍可以在他的计算机上正常运行,没有任何错误。

0 个答案:

没有答案