[关闭]
@Cesar 2015-11-26T10:27:36.000000Z 字数 1060 阅读 1506

解决UnsupportedClassVersionError

Java 异常处理


本文链接


在一个web项目中,运行TestCase代码的时候程序报错,错误原因如下:

  1. java.lang.UnsupportedClassVersionError: cesar/thread/test/testUtil : Unsupported major.minor version 52.0
  2. at java.lang.ClassLoader.defineClass1(Native Method)
  3. at java.lang.ClassLoader.defineClass(Unknown Source)
  4. at java.security.SecureClassLoader.defineClass(Unknown Source)
  5. at java.net.URLClassLoader.defineClass(Unknown Source)
  6. at java.net.URLClassLoader.access$100(Unknown Source)
  7. at java.net.URLClassLoader$1.run(Unknown Source)
  8. ......



但此时项目仍然无法运行,项目报错:

  1. Java compiler level does not match the version of the installed Java project facet.

解决办法:

右键项目“Properties”,在弹出的“Properties”窗口左侧,单击“ProjectFacets”,打开“ProjectFacets”页面。在页面中的“Java”下拉列表中,选择相应版本就OK了


此时又报错:

  1. The project was not built due to "Could not delete '/firstTest/build/classes/cesar'.". Fix the problem, then try refreshing this project and building it since it may be inconsistent

解决办法:

windows -> clean ,将项目重新刷新

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注