Eclipse is nice IDE but it has it’s own problems. This time the Java Search and Open Type -search produced an error saying “Class file name must end with .class”. Very helpfull. Fortunately almost all the answers in the world can be found in the Internet and so with a quick googling the solution to this annoying problem was found on Stack Overflow.
I had already tried Project -> Clean… and closing Eclipse, deleting all the built class files and restarting Eclipse to no avail as was the original question author. The right answer lies in deleting the corrupted search index which is explained in Eclipse bug’s #269820 comment.
How to delete the search index:
- Close Eclipse
- Delete workspace/.metadata/.plugins/org.eclipse.jdt.core/*.index
- Delete workspace/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt
- Start Eclipse again
This fixed the issue for me.