Eclipse compilation error: The hierarchy of the type 'Class name' is inconsistent

It means you are trying to implement a non-existing interface or you're extending an non-existing class.

Try to refresh your Eclipse.

If it doesn't work, it may mean that you have a reference to a JAR that is not in the build path. Check your project's classpath and verify that the jar containing the interface or the class is in it.


Sometimes it happens when you add a jar that YOU need, but don't include the jars that IT needs. In my case adding all the jars in tomcat/lib helped me to solve this problem. I am working on a web-app.


Check your errors (tab "markers"). I had also the following error:

Archive for required library in project cannot be read...

and when that was fixed the "inconsistent-error" disappeared.

Actually I had added jars to the build path, but for some reason they could not be read with error

Archive for required library in project cannot be read or is not a valid ZIP file

So instead I added them as "External Jars". That helped and all compilation problems were no more!

Tags:

Java

Eclipse