Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

eclipse

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!


I had this problem after I upgraded the JDK to a new version. I had to update the references to libraries in Project Properties/Java Build Path.


One more case I have had. Give the correct project path, and import it to eclipse.

Then go to Project--> Clean --> Clean all projects.


You should clean the project , or restart Eclipse.