I am using Eclipse and have not used Java for sometime. However, I can compile my code on the command-line just fine and generate the necessary .class
files. In
I was using Spring Tool Suite 4. Not able to figure out the issue. The directory structure was according to the package name.
But cleaning the project helped me.
This happened to me when I was checking out a project from an svn repository in eclipse. There were jar files in my .m2 folder that eclipse wasn't looking at. To fix the issue I did:
right click project folder Configure > Convert to Maven Project
and that solved the issue.
Create a new package under your project called "Devices" and place your class in it. This is equivalent to the class being placed in a directory called "Devices" in your project source folder.
Got the same kind of error but my package was absolutely correct. When I just closed and opened my editor, the error disappears. Hope this might help in some scenarios.
I faced this issue too when I had imported an existing project to eclipse. It was a gradle project, but while importing I imported it as regular project by clicking General-> Existing Projects into Workspace. To resolve the issue I've added Gradle nature to the project by :::: Right click on Project folder -> Configure-> Add Gradle Nature
Make sure that Devices
is defined as a source folder in the project properties.