How can I prevent Eclipse from automatically deleting my exe file


I use Eclipse for Java development.

There is an *.exe file in a subdirectory of my workspace, which keeps getting deleted.

Specifically, one of the projects is dedicated to C++ development using MSVC; there is no Java there. The root of this project has cpp and h files, and I use MSVC to generate the exe under the /bin directory.

As part of its built-in build process, Eclipse deletes this exe file as it compiles *.java files, apparently because it thinks that the exe file is binary output. Note that the exe is not in any /target directory.

By the way, I am using the Maven-Eclipse plugin, but this behavior apparently occurs when Eclipse is building the workspace, not part of a Maven run.

I'd rather keep the exe in this directory; it is the right place to have it, and so I would rather not go to the effort of moving it as a workaround. How can I prevent this from happening? Is there some configuration within Eclipse where I can state that exe files are not to be cleaned when building?

The problem is you are storing your executable in /bin, which is an Eclipse output directory. This directory gets removed each time you do a clean build. Solution: store your executable elsewhere (i.e. /exe).