Fixing Resource Already Exists on Disk Errors in Eclipse

When I imported a new project I could not build it because of “Resource already exists on disk” errors like this.

Eclipse: The project was not built due to "Resource already exists on disk"

The simple fix was to remove the directory, typically classes, which contained the file it was complaining about and then refreshing. Removing just the file and then refreshing did not work.

However when I would do an ant build later and then refresh my project I would get the same error.

The better solution is to tell Eclipse not to copy the files it is complaining about to the output folder.

  1. Go to Project Properties.
  2. Select Java Compiler -> Building.
  3. In the Filtered resources box add the files you don’t want copied.
  4. Rebuild project.

Here is a screenshot showing how I added “*.properties, *.xslt” to the Filtered resources to fix this problem.

Eclipse: Filtered resources in Project Properties, Java Compiler, Building

Eclipse: Filtered resources in Project Properties, Java Compiler, Building

5 thoughts on “Fixing Resource Already Exists on Disk Errors in Eclipse

  1. This post is awesome! Thanks so much. This has been bugging the heck out of me for about 10 months now. I’ve been looking all around the internet and the typical proposed solution is to just delete the contents of the bin directory, which is a temporary workaround, not a fix to the problem.

    Well done!

Leave a Reply

Your email address will not be published. Required fields are marked *