score:1448

Accepted answer

eclipse is defaulting to java 1.5 and you have classes implementing interface methods (which in java 1.6 can be annotated with @override, but in java 1.5 can only be applied to methods overriding a superclass method).

go to your project/ide preferences and set the java compiler level to 1.6 and also make sure you select jre 1.6 to execute your program from eclipse.

score:0

it's 2020 -

project>right click>java compiler>compiler compliance level> change this to 1.8 [or latest level]

enter image description here

score:2

this happens when your maven project uses different compiler compliance level and eclipse ide uses different compiler compliance level. in order to fix this we need to change the compiler compliance level of maven project to the level ide uses.

1) to see java compiler compliance level uses in eclipse ide

*) window -> preferences -> compiler -> compiler compliance level : 1.8 (or 1.7, 1.6 ,, ect)

2) to change java compiler compliance level of maven project

*) go to "project" -> "properties" -> select "java compiler" -> change the compiler compliance level : 1.8 (or 1.7, 1.6 ,, ect)

score:6

in my case, none the solutions above works. i have to checkout my source code to another folder. from eclipse select file > switch workspaces > other... and then import code to the new workspaces. it works after that.

score:10

fixing must override a super class method error is not difficult, you just need to change java source version to 1.6 because from java 1.6 @override annotation can be used along with interface method. in order to change source version to 1.6 follow below steps :

  1. select project , right click , properties
  2. select java compiler and check the check box "enable project specific settings"
  3. now make compiler compliance level to 1.6
  4. apply changes

score:11

this is my second time encounter this problem. first time according the alphazero's recommendation it worked. but in the second time i set to 1.6 it don't work it just like 'cache' this error after clean and rebuild.

try to switch off 'build automatically' as rollin_s said -> error still here!

so i removed the problem project (already set to 1.6) from package explorer and import it again -> it start a rebuild and no error this time

hope this help someone

score:11

in my case this problem happened when i imported a maven project into eclipse. to solve this, i added the following in pom.xml:

<properties>
   ...
   <maven.compiler.source>1.8</maven.compiler.source>
   <maven.compiler.target>1.8</maven.compiler.target>
</properties>

then in the context menu of the project, go to "maven -> update project ...", and press ok.

that's it. hope this helps.

score:14

guys in my case none of the solutions above worked.

i had to delete the files within the project workspace:

  • .project
  • .classpath

and the folder:

  • .settings

then i copied the ones from a similar project that was working before. this managed to fix my broken project.

of course do not use this method before trying the previous alternatives!.

score:15

if nothing of the above helps, make sure you have a proper "execution environment" selected, and not an "alternate jre".

to be found under:

project -> build path -> libraries

select the jre system library and click edit....

if "alternate jre ..." is selected, change it to a fitting "execution environment" like javase-1.8 (jre1.8.0_60). no idea why, but this will solve it.

score:23

the answer by paul worked for me partially. i still had one error then. so, in addition to that, i also had to go to properties-> project facets and there set the java version from 1.5 to 1.6.

maybe that helps.

score:41

to resolve this issue, go to your project properties -> java compiler -> select compiler compliance level to 1.6-> apply.

score:80

in case this happens to anyone else who tried both alphazero and paul's method and still didn't work.

for me, eclipse somehow 'cached' the compile errors even after doing a project > clean...

i had to uncheck project > build automatically, then do a project > clean, and then build again.

also, when in doubt, try restarting eclipse. this can fix a lot of awkward, unexplainable errors.

score:308

with eclipse galileo you go to eclipse -> preferences menu item, then select java and compiler in the dialog.

now it still may show compiler compliance level at 1.6, yet you still see this problem. so now select the link "configure project specific settings..." and in there you'll see the project is set to 1.5, now change this to 1.6. you'll need to do this for all affected projects.

this byzantine menu / dialog interface is typical of eclipse's poor ui design.


Related Query

More Query from same tag