Eclipse Build Error "A class file was not written. The project may be inconsistent, if so try refreshing this project and building it"

I had the same problem and here's how I solved it in the end: It turned out that the disc space on the drive where workspace resides was full.

Silly mistake but worth checking.


In my case, this was caused by the fact that the build output directories were owned by a different user, and Eclipse could not write into them.


Clean your workspace by starting eclipse from the command line with the -clean argument :

eclipse -clean

See also How to run eclipse in clean mode? and what happens if we do so?