Aas I was working with some ANT scripts today (well, yesterday by the time I finish the post) I stumbled upon a strange situation (or so I thought at first): my ANT task failed when trying to delete some JAR files. I checked the path to the file – it was correct. I checked if the file existed – it was there, waiting quietly. I checked its properties – it was read-only. I said bingo, changed the attribute and ran the task again. 2 seconds later, the same error. I checked whether other programs had the file opened. None.
Some minutes later, after searching for a bit on the net I verified the system CLASSPATH environment variable. And there were the two causes: I had the .Â added to the classpath. And so it seems that this is why JARS cannot be removed automatically by ANT.
Now, as a rule of thumb, it’s not very smart to have the . in your classpath variable (in my defence I added it for a test before leaving work the previous day and forgot to put it out), but if you run into files that will not die, check it out – it’s worth a look.