<p>I was hoping someone could help me out with a problem I'm having using the java search function in Eclipse on a particular project.</p>

<p>When using the java search on one particular project, I get an error message saying <code>Class file name must end with .class</code> (see stack trace below). This does not seem to be happening on all projects, just one particular one, so perhaps there's something I should try to get rebuilt?</p>

<p>I have already tried <code>Project -&gt; Clean</code>... and Closing Eclipse, deleting all the built class files and restarting Eclipse to no avail.</p>

<p>The only reference I've been able to find on Google for the problem is at <a href="http://www.crazysquirrel.com/computing/java/eclipse/error-during-java-search.jspx" rel="noreferrer">http://www.crazysquirrel.com/computing/java/eclipse/error-during-java-search.jspx</a>, but unfortunately his solution (closing, deleting class files, restarting) did not work for me.</p>

<p>If anyone can suggest something to try, or there's any more info I can gather which might help track it's down, I'd greatly appreciate the pointers.</p>

<pre><code>Version: 3.4.0
Build id: I20080617-2000
</code></pre>

<p>Also just found this thread - <a href="http://www.myeclipseide.com/PNphpBB2-viewtopic-t-20067.html" rel="noreferrer">http://www.myeclipseide.com/PNphpBB2-viewtopic-t-20067.html</a> - which indicates the same problem may occur when the project name contains a period. Unfortunately, that's not the case in my setup, so I'm still stuck.</p>

<pre><code>Caused by: java.lang.IllegalArgumentException: Class file name must end with .class
at org.eclipse.jdt.internal.core.PackageFragment.getClassFile(PackageFragment.java:182)
at org.eclipse.jdt.internal.core.util.HandleFactory.createOpenable(HandleFactory.java:109)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1177)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:94)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:223)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:506)
at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:551)
at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.internalSearch(RefactoringSearchEngine.java:142)
at org.eclipse.jdt.internal.corext.refactoring.RefactoringSearchEngine.search(RefactoringSearchEngine.java:129)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.initializeReferences(RenameTypeProcessor.java:594)
at org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor.doCheckFinalConditions(RenameTypeProcessor.java:522)
at org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor.checkFinalConditions(JavaRenameProcessor.java:45)
at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:225)
at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:160)
at org.eclipse.jdt.internal.ui.refactoring.RefactoringExecutionHelper$Operation.run(RefactoringExecutionHelper.java:77)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4650)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:92)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
</code></pre>

<p>Thanks McDowell, closing and opening the project seems to have fixed it (at least for now).</p>

[{'answer_id': 6840, 'author': 'McDowell', 'author_id': 304, 'author_profile': 'https://Stackoverflow.com/users/304', 'pm_score': 7, 'selected': True, 'text': '<p>Two more general-purpose mechanisms for fixing some of Eclipse\'s idiosyncrasies:</p>\n\n<ul>\n<li>Close and open the project</li>\n<li>Delete the project (but not from disk!) and reimport it as an existing project</li>\n</ul>\n\n<p>Failing that, <a href="https://bugs.eclipse.org/bugs/buglist.cgi?query_format=specific&amp;order=relevance+desc&amp;bug_status=__all__&amp;product=JDT&amp;content=Class+file+name+must+end+with+.class" rel="noreferrer">bugs.eclipse.org</a> might provide the answer.</p>\n\n<p>If the workspace is caching something broken, you may be able to delete it by poking around in <strong>workspace/.metadata/.plugins</strong>. Most of that stuff is fairly transient (though backup and watch for deleted preferences).</p>\n'}, {'answer_id': 305214, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': "<p>Got this error to the other day. Tried deleting the all .class-files and resources from my output folder manually. Didn't work. Restarted my computer (WinXP). Didn't work. Closed my project in Eclipse and opened it again. <strong>Worked!!!</strong> Hopes this solves someones problem out there. The search facilities and truly essential to Eclipse.</p>\n"}, {'answer_id': 808782, 'author': 'Olivier Dagenais', 'author_id': 98903, 'author_profile': 'https://Stackoverflow.com/users/98903', 'pm_score': 6, 'selected': False, 'text': '<p>Comment <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=269820#c9" rel="noreferrer">#9 to bug 269820</a> explains how to delete the search index, which appears to be the solution to a corrupt index whose symptoms are the dreaded</p>\n\n<blockquote>\n  <p>An internal error occurred during: "Items filtering".<br />\n  Class file name must end with .class</p>\n</blockquote>\n\n<p>message box.</p>\n\n<p>How to delete the search index:</p>\n\n<ol>\n<li>Close Eclipse</li>\n<li>Delete &lt;workspace&gt;/.metadata/.plugins/org.eclipse.jdt.core/*.index</li>\n<li>Delete &lt;workspace&gt;/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt</li>\n<li>Start Eclipse again</li>\n</ol>\n'}, {'answer_id': 1220707, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>I also encountered this issue recently, the below scenario worked for me.</p>\n\n<ol>\n<li>Close Eclipse</li>\n<li>Delete <code>&lt;workspace&gt;/.metadata/.plugins/org.eclipse.jdt.core/*.index</code> </li>\n<li>Delete <code>&lt;workspace&gt;/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt</code> </li>\n<li>Start Eclipse again </li>\n</ol>\n'}, {'answer_id': 1903106, 'author': 'Rick', 'author_id': 129104, 'author_profile': 'https://Stackoverflow.com/users/129104', 'pm_score': 2, 'selected': False, 'text': "<p>Closing the projects didn't do the trick for me. I started eclipse with the -clean flag and that worked for some reason.</p>\n"}, {'answer_id': 5403613, 'author': 'LoganMzz', 'author_id': 672780, 'author_profile': 'https://Stackoverflow.com/users/672780', 'pm_score': 2, 'selected': False, 'text': '<p>Just</p>\n\n<ul>\n<li>Close project</li>\n<li>Clear manually output folder(s)</li>\n<li>Open project</li>\n</ul>\n\n<p>(Eclipse 3.5 SR2, Build id: 20100218-1602)</p>\n'}]
['https://Stackoverflow.com/questions/6816', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/797/']