---
title: "在eclipse中搜索时，搜索完之后有时候会弹出错误对话框"
author: "hougbin"
date: "2013-04-10T16:01:33Z"
tags: []
categories: ["开源软件"]
slug: "eclipse"
draft: false
lastmod: "2013-04-10T16:01:33Z"
id: 1845166
url: "https://hougbin.iteye.com/blog/1845166"
---

在eclipse中搜索时，搜索完之后有时候会弹出错误对话框，错误摘录如下：  
Resource is out of sync with the file system......

**分析：**  
有时候因为时间紧迫的原因，所以就没去管它，今天再次遇到它，实在看着不爽，所以想了办法解决此问题！

这个问题是由于eclipse中文件不同步引起的。在eclipse中，工程文件是由eclipse自动扫描添加的，如果在外部修改了工程目录中的文件但又关闭了自动刷新功能，则会引起文件不同步，从而搜索时出现Resource is out of sync with the file system问题（其它功能可能也会如此）。此外，在外部没有修改eclipse工程中的文件也有可能引起该问题。

**解决方法：**  
有两种解决方法：  
1）手动刷新。即在eclipse的工程目录中，右键refresh（或者按下F5）。  
2）配置eclipse的选项：  
a）eclipse启动时，刷新workspace，即勾选：window—&gt;preferences—&gt;general—&gt;startup and shutdown—&gt;refresh workspace on startup；  
b）window—&gt;preferences—&gt;general—&gt;workspace中：勾选选项：refresh using native hooks or polling和refresh on access；