Eclipse Error: "The Import Xxx Cannot Be Resolved"

Eclipse error: The import XXX cannot be resolved

I found the problem. It was the hibernate3.jar. I don't know why it was not well extracted from the .zip, maybe corrupt. A good way to check if jars are corrupt or not is navigating through their tree structure in "Project Explorer" in Eclipse: if you can't expand a jar node probably it's corrupt. I've seen that having corrupt packages it's frequent when you drag and drop them to the "Project Explorer". Maybe it's better to move and copy them in the OS environment! Thankyou all.

The import cannot be resolved in eclipse

In my experience, it is usual with Eclipse to have the build messed up. Make sure Build automatically is checked and Clean. If it doesn't work, restart Eclipse and do again.

Also as Tech Junkie comments below, try also Clean all projects.

Eclipse error: “The import ... cannot be resolved”

You included the source (src) folder og-analytics/src/main/java which contains the *.java files instead of the classes (bin or classes) folder with the *.class files (in your case, probably og-analytics/target/classes).

But instead using Add Class Folder... you should add the project og-analytics in the tab Projects. Or even better, in the Maven pom.xml file add the dependency to the project og-analytics like you did for og-util.

Import XXX cannot be resolved for Java SE standard classes

Right click on project - >BuildPath - >Configure BuildPath - >Libraries tab - >

Double click on JRE SYSTEM LIBRARY - >Then select alternate JRE

Java 11: why The import xxx cannot be resolved even with module-info informing it is required

I found the issue. Probably it will seem very silly for others more experienced with Java9+ but for me took a while to find the root cause. Hopefully it can be usefull for future readers.

The problem: common project was in classpath instead of module-path

Sample Image

The solution: just move to module-path as sugested by Eclipse when I handed over requires common; in module-info.java When I handovered import com.test.common.security.JwtConfig; on SecurityTokenConfig.java the solution proposed is completed diferent from the one when I handed over module-info.java (maybe a modest suggestion to Eclipse team would be revview it from now on but it is beyond the purpose of this question).

Sample Image

Credits to https://www.eclipse.org/community/eclipse_newsletter/2018/june/java9andbeyond.php

*** edited

Although I still consider the above solution as the answer to my question I must admit that after fixed this issue I stumbled on a new issue and I realize that, at least for my case, even using Java 11 I must avoid modularity (Jigsaw). Future readers may get interested on this thread also

Java 11 without modularity: package does not exist while it is added as maven dependency

Eclipse error: The import XXX cannot be resolved

I found the problem. It was the hibernate3.jar. I don't know why it was not well extracted from the .zip, maybe corrupt. A good way to check if jars are corrupt or not is navigating through their tree structure in "Project Explorer" in Eclipse: if you can't expand a jar node probably it's corrupt. I've seen that having corrupt packages it's frequent when you drag and drop them to the "Project Explorer". Maybe it's better to move and copy them in the OS environment! Thankyou all.

Eclipse error: The import XXX cannot be resolved

I found the problem. It was the hibernate3.jar. I don't know why it was not well extracted from the .zip, maybe corrupt. A good way to check if jars are corrupt or not is navigating through their tree structure in "Project Explorer" in Eclipse: if you can't expand a jar node probably it's corrupt. I've seen that having corrupt packages it's frequent when you drag and drop them to the "Project Explorer". Maybe it's better to move and copy them in the OS environment! Thankyou all.



Related Topics



Leave a reply



Submit