Class file name must end with .class exception in Java Search

Solution 1:

Comment #9 to bug 269820 explains how to delete the search index, which appears to be the solution to a corrupt index whose symptoms are the dreaded

An internal error occurred during: "Items filtering".
Class file name must end with .class

message box.

How to delete the search index:

  1. Close Eclipse
  2. Delete <workspace>/.metadata/.plugins/org.eclipse.jdt.core/*.index
  3. Delete <workspace>/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt
  4. Start Eclipse again

Solution 2:

Two more general-purpose mechanisms for fixing some of Eclipse's idiosyncrasies:

  • Close and open the project
  • Delete the project (but not from disk!) and reimport it as an existing project

Failing that, bugs.eclipse.org might provide the answer.

If the workspace is caching something broken, you may be able to delete it by poking around in workspace/.metadata/.plugins. Most of that stuff is fairly transient (though backup and watch for deleted preferences).