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
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).
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
Quickest Way to Find Missing Number in an Array of Numbers
Should We @Override an Interface's Method Implementation
Should I Return a Collection or a Stream
How to Handle Very Large Numbers in Java Without Using Java.Math.Biginteger
How to Write a Java Application That Can Update Itself at Runtime
How to Remove Entity with Manytomany Relationship in JPA (And Corresponding Join Table Rows)
Jlabel - Show Longer Text as Multiple Lines
Parsing a Date's Ordinal Indicator ( St, Nd, Rd, Th ) in a Date-Time String
Windowbuilder Design Tab Incomplete in Eclipse
Get Edited Treenode from a Celleditorlistener
Struts2: Updating the Values of a "List of Objects" Inside a Map
Add an Background Image to a Panel
Why Is String Immutable in Java
In Java, What Are the Advantages of Streams Over Loops
Differencebetween a Javabean and a Pojo