我希望有人可以帮助我解决特定项目中在Eclipse中使用Java搜索功能的问题。
在一个特定项目上使用Java搜索时,出现一条错误消息Class file name must end with .class
(请参见下面的堆栈跟踪)。似乎并非所有项目都在发生这种情况,只是一个特定项目在发生,所以也许我应该尝试重新构建某些内容?
我已经尝试过Project -> Clean
...并关闭Eclipse,删除所有构建的类文件,然后重新启动Eclipse无济于事。
我可以在Google上找到有关该问题的唯一参考,网址为http://www.crazysquirrel.com/computing/java/eclipse/error-during-java-search.jspx,但很遗憾,他的解决方案是删除班级文件,然后重新启动)对我不起作用。
如果有人可以建议您尝试一下,或者我可以收集更多信息来帮助您解决问题,我将非常感谢您提供的建议。
Version: 3.4.0
Build id: I20080617-2000
也刚刚发现了这个线程-http: //www.myeclipseide.com/PNphpBB2-viewtopic-t-20067.html-这表明当项目名称包含句点时,可能会出现相同的问题。不幸的是,在我的设置中情况并非如此,因此我仍然陷入困境。
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)
感谢McDowell,关闭和打开项目似乎已经修复了它(至少现在是这样)。