eclipse运行项目报错:Unsupported major.minor version 52.0

从Android Studio项目跳回到Eclipse跑项目,编译后报错,如下图所示:



看了下报错信息,主要是:Unsupported major.minor version 52.0.意思是说不支持52.0版本.我再网上查了很多资料,都没有合适的回答,看到一个老外的总结,简单又详细(原文出处:https://stackoverflow.com/questions/22489398/unsupported-major-minor-version-52-0):


The issue is because of Java version mismatch. Referring to the Wikipedia Java Class Reference :

  • J2SE 9 = 53
  • J2SE 8 = 52
  • J2SE 7 = 51
  • J2SE 6.0 = 50
  • J2SE 5.0 = 49
  • JDK 1.4 = 48
  • JDK 1.3 = 47
  • JDK 1.2 = 46
  • JDK 1.1 = 45

These are the assigned major numbers. The error regarding the unsupported major.minor version is because during compile time you are using a higher JDK and a lower JDK during runtime.

Thus, the 'major.minor version 52.0' error is possibly because the jar was compiled in jdk 1.8, but you are trying to run it using a jdk 1.7 environment. The reported number is the required number, not the number you are using. To solve this, it's always better to have the jdk and jre pointed to the same version.

我来翻译一下:


这个问题是因为JAVA版本的不匹配,具体对照给出来了.那些对照是主要的版本对应关系.在运行的时候,你用了一个更高的或者更低的JDK.所以,报出"52.0"序号的错误很大程度上是因为你没有用JDK1.8(毕竟52.0和JDK1.8是一一对应的关系).像报错出来的那些数字(52.0这样的)是需要的版本而不是你目前在用的版本.所以,最好把你的JDK和JRE版本跟你的软件的版本匹配起来.


我去看了我的JDK,果然是1.7的,当即从官网上下载了自己的windows64位的JDK_1.8(网站:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html),配好路径之后重新编译,完美通过.

你可能感兴趣的:(android,technology)