现在的位置: 首页 > 综合 > 正文

解决导入工程文件到Eclipse@override注释报错

2013年06月16日 ⁄ 综合 ⁄ 共 510字 ⁄ 字号 评论关闭

 @override注释在jdk1.5环境下只能用于对继承的类的方法的重写,而不能用于对实现的接口中的方法的实现。

解决办法:
1,在右键项目选择Properties-->java Compiler-->Compiler Compliance Level-->将jdk设置为6.0.
2,如果还不行就查看一下Windows-->Preferences-->tomcat-->jdk-->tomcat JDK home ,选择与项目一直的jdk。

开发环境要注意项目里的jdk和tomcat JDK要匹配

另外有时候会报这种错误:Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener 或者bad version number in .class file unable to load class,也是由于项目变量中的jdk版本和Compiler Compliance Level中jdk版本不一致所一致

转自http://heisetoufa.iteye.com/blog/1058217

抱歉!评论已关闭.