今天,在用Eclipse编译一个Java工程的时候,始终无法通过编译,经过查看,问题出在@Override这里。

      按照网上的说法,是因为Eclipse默认使用Java 1.5的编译器,需要更改到1.6才行。

      但是,我查看“Windows->Preferences-->java->Compiler-->compiler compliance level”的时候,发现它已经是1.6.

      经过仔细排查发现,该工程之下有一个隐藏目录,.settings,其下有一个文件,org.eclipse.jdt.core.prefs,内容是:

eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5

     将里面的1.5全部改成1.6,或者干脆将.settings删除掉,就可以解决问题了。      

      

相关文章:

  • 2021-06-26
  • 2022-12-23
  • 2021-08-14
  • 2021-08-26
  • 2022-01-16
  • 2021-04-15
  • 2021-12-24
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2021-09-10
  • 2022-01-22
  • 2021-11-14
相关资源
相似解决方案