Java – Eclipse error: “The import XXX cannot be resolved”

buildpatheclipseimportjarjava

I'm trying to work with Hibernate in Eclipse.
I'm creating a new simple project and I've downloaded a collegue project too, via CVS.
Both don't work, while on my collegue's Eclipse do.
The problem is that, for each import of an Hibernate class, Eclipse says:

The import org.hibernate cannot be resolved

But all Hibernate jars are in the build path, that is:

antlr-2.7.6.jar
cglib-2.2.jar
commons-collections-3.1.jar
dom4j-1.6.1.jar
hibernate3.jar
hibernate-jpa-2.0-api-1.0.0.Final.jar
javassist-3.12.0.GA.jar
jta-1.1.jar
slf4j-api-1.6.1.jar

Best Answer

Try cleaning your project by going to the following menu item:

Project > Clean...

If that doesn't work, try removing the jars from the build path and adding them again.