JAVA 不支持的major.minor 版本 51.0
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20690143/
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 51.0
提问by user3120480
I'm not a programmer but I couldn't find any answer on this website. I'm trying to run a game on linux ubuntu with Java Open JDK but nothing happen. I tried to run it with the prompt command and it said this:
我不是程序员,但我在这个网站上找不到任何答案。我正在尝试使用 Java Open JDK 在 linux ubuntu 上运行游戏,但没有任何反应。我尝试使用提示命令运行它,它说:
leops95@leops95-SATELLITE-C660:~$ '/home/leops95/Bureau/Minecraft.jar' Exception in thread "main" java.lang.UnsupportedClassVersionError: net/kc/main/Main :
leops95@leops95-SATELLITE-C660:~$ '/home/leops95/Bureau/Minecraft.jar' 线程“main”中的异常 java.lang.UnsupportedClassVersionError: net/kc/main/Main :
Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.accessapt-get install openjdk-7-jdk
0(URLClassLoader.java:73)
at java.net.URLClassLoader.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: net.kc.main.Main. Program will exit.
找不到主类:net.kc.main.Main。程序将会退出。
I think there is something wrong with the version of Java, right ?
我认为 Java 的版本有问题,对吧?
回答by Rahul Tripathi
This is because of a higher JDK during compile time and lower JDK during runtime. So you just need to update your JDK version, possible to JDK 7
这是因为编译时 JDK 较高,运行时 JDK 较低。所以你只需要更新你的 JDK 版本,可能到JDK 7
You may also check Unsupported major.minor version 51.0
回答by Thorbj?rn Ravn Andersen
The Java runtime you try to execute your program with is an earlier version than Java 7 which was the target you compile your program for.
您尝试使用的 Java 运行时是比 Java 7 更早的版本,Java 7 是您编译程序的目标。
For Ubuntu use
对于 Ubuntu 使用
##代码##to get Java 7 as default. You may have to uninstall openjdk-6 first.
将 Java 7 设为默认值。您可能必须先卸载 openjdk-6。