Search code examples
javaeclipsebuild.class-file

How to prevent Eclipse from cleaning the bin folder for every build?


I am now doing a project using Eclipse, and I have some resource files (e.g., image, text) saved in the bin folder, and these files are needed by the program.

However, with every build, Eclipse would try to clean up the folder, then rebuild the project. When cleaning, it deletes the resource files in the folder. Is there anyway to stop Eclipse from doing this?

I know I could change the location of the files, but I am also curious why Eclipse would do this, and could this be prevented from happening.

Thanks!


Solution

  • I can't say exactly why it does it, but probably that's just how Eclipse does the build: empty the "output folder" and start compiling.

    That said, if you put your files into a source folder, then Eclipse will simply copy the files over to bin on every build and they won't disappear. It will do this to any file it doesn't know how to compile, e.g. .xml, .xsd, .png, etc.