Pedro Teran
Pedro Teran

Reputation: 1200

The method must override a superclass method

Recently I updated my computer to Ubuntu 11.10 64-bits. I have a problem when importing my projects, it gives me an error

"The method onView() must override a superclass method".

I read in some other posts that the error should be the use of java 1.5, but Ubuntu 11.10 comes with open-6-jdk.

any ideas of a solution?

Upvotes: 3

Views: 8666

Answers (3)

Vikas Piprade
Vikas Piprade

Reputation: 352

It's 2020 -

Project>Right Click>Java Compiler>Compiler Compliance Level> Change this to 1.8 [or latest level] enter image description here

Upvotes: 0

Konrad Höffner
Konrad Höffner

Reputation: 12207

Maybe you have multiple java virtual machines on your machine. Please type

$ ls /usr/lib/jvm

Do you see multiple entries there?

If yes, start Eclipse and go to Help->About Eclipse Platform->Configuration Details, and look for the property java.version (for me it is 1.7.0_03-icedtea).

If it is the wrong one you can go to Window->Preferences->Java->Installed JREs you can then change it to the one you like.

Upvotes: 1

Ted Hopp
Ted Hopp

Reputation: 234847

It sounds like the JDK compliance level of your project is set to 1.5. (The version of Java installed on the machine only determines how high you can set the compliance level.) You can check this in Eclipse by opening the project properties (right click on the project name, then select "Properties") and selecting "Java Compiler" on the left.

In Java 1.6, the @Override annotation can (and should) be used on methods that are defined in implemented interfaces. Java 1.5 did not allow this.

Upvotes: 13

Related Questions