Reputation: 4283
The text of my specific error msg today is
...\Find\nbproject\build-impl.xml:
1388: Unable to delete directory ...\Find\
dist`
The same error (can't delete dist
) spuriously, but very infrequently, occurs when Clean and Build Project
is attempted in Netbeans 8.0.2.
The dist
folder is where the successfully-compiled java
project .jar
file will be located, so the compiler first wants to delete dist
, but for some reason (timing?) occasionally can't.
When I get this error, I always get it fixed one way or other, but not by deleting the folder by hand, which is the first obvious thing to try. I never remember how to get it done except trying this (restart Netbeans) or that (reboot) or some other large pain.
But how about doing this cut-to-the-chase method:
-- Click the error message--it's a link, in my case today, to line 1388
of build-impl.xml
, which says:
1388: <delete dir="${
dist.dir}" followsymlinks="false" includeemptydirs="true"/>
(Make a copy of this line and its line number so you can put it back later.)
-- After confirming that there is nothing in the dist
folder, delete the line with the error and recompile. (I've never seen anything in the dist
folder when this error occurs.)
-- Put the line (1388) back where it belongs.
I know I shouldn't mess with files that aren't "mine", but when Clean and Rebuild
is broken for whatever glitchy reason, why not make this exception, especially since the line is essentially pointless under the circumstances (nothing is in it) and besides is only removed for about ten seconds?
(Please note that I'm not asking for opinions; rather confirmation or not of the procedure.)
Upvotes: 1
Views: 1205
Reputation: 179
Something is accessing/locking the dist folder on clean and your OS won't let Netbeans delete it, hence the error. Make sure you are not in the dist folder or you are not accessing anything in there when you do a clean. For instance, if you have a command window that is in that folder.
Often it's your Apache or Glassfish or Tomcat server that is using the files in dist. Try stopping these services before the clean operation. Windows has the worst time with it -- often leaving the lock for unknown reasons. No need to edit the files in the Netbeans folders though.
If you really want to know what is locking this folder, try finding a "who lock me" or similar application that will tell you who is accessing the folder.
If you are just working through code, you can just do a build (not clean and build).
Upvotes: 1