Java Unsupported major.minor version 52.0 错误 Minecraft
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27143461/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java Unsupported major.minor version 52.0 error Minecraft
提问by Madster
I am currently trying to run a plugin im working on onto a test server. The Minecraft server is running spigot 1.7.10, here is the servers java version:
我目前正在尝试在测试服务器上运行我正在处理的插件。Minecraft 服务器运行 spigot 1.7.10,这里是服务器 java 版本:
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
here is my java version
这是我的 Java 版本
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
So it makes no sense why I should be getting this error on my plugin when loading it.
因此,为什么我在加载插件时应该在我的插件上收到此错误是没有意义的。
26.11 02:19:38 [Server] INFO org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: mad/madster/msm/Main : Unsupported major.minor version 52.0
I am using eclipse luna on windows 8.
我在 Windows 8 上使用 eclipse luna。
采纳答案by user253751
You are compiling your plugin with the Java 8 compiler. You are running your server with Java 7, which is not capable of reading the Java 8-format class files in your plugin.
您正在使用 Java 8 编译器编译您的插件。您正在使用 Java 7 运行服务器,它无法读取插件中的 Java 8 格式类文件。
You can either:
您可以:
- Update the server to Java 8.
- Make Eclipse use the Java 7 compiler (if it's installed on your development machine) by selecting a Java 7 JDK version, in Preferences > Java > Installed JREs:
- Make Eclipse tell the Java 8 compiler to pretend to be the Java 7 compiler, by setting your "compiler compliance level" to 1.7, in Preferences > Java > Compiler:
- 将服务器更新到 Java 8。
- 通过在 Preferences > Java > Installed JREs 中选择 Java 7 JDK 版本,使 Eclipse 使用 Java 7 编译器(如果它安装在您的开发机器上):
- 通过在 Preferences > Java > Compiler 中将“编译器合规级别”设置为 1.7,让 Eclipse 告诉 Java 8 编译器假装是 Java 7 编译器:
回答by Jens
You have to download java8 and run it with this jre.
您必须下载 java8 并使用此 jre 运行它。
回答by Svetlin Zarev
Your code has been compiled with Java 8, while you are trying to run it with Java 7. Note that Eclipse has it's own compiler and does not use the one from the JDK and most probably it is configured to use Java 8. Check you eclipse compiler preferences.
您的代码已使用 Java 8 编译,而您正在尝试使用 Java 7 运行它。请注意,Eclipse 有自己的编译器,不使用 JDK 中的编译器,而且很可能已配置为使用 Java 8。检查您的 eclipse编译器首选项。