Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse could not delete error

I'm working on a project with Eclipse and by now everything was fine, but last time I've tried building it, it returned the error,

"The project was not built due to "Could not delete '/Torpedo/bin/bin'.". Fix the problem, then try refreshing this project and building it since it may be inconsistent Torpedo Unknown Java Problem"

And it deleted my bin folder which stores all the images and stuff needed for the program. (Fortunately I had a backup). I've tried googling it and tried every solution I found, but nothing helped, and also most of them suggests to delete the folder by hand, which I can't. What should I do?

like image 256
KáGé Avatar asked Apr 18 '10 03:04

KáGé


People also ask

How do I permanently delete a file in Eclipse?

Projects can be deleted within Eclipse. Just select the project and choose delete. If you want to completely remove it from your harddisk you have to select "Delete project contents on disk" in the appearing dialogue.

How do I delete a file in Eclipse?

To delete a project, right-click on the project in the Package Explorer. Again, select “Delete” from the context menu. To delete your project select the option “Also delete contents under…” and select “Yes.”

How do I delete an Eclipse project without deleting it?

Make sure the “Do not delete contents” radio button is selected, and then click Yes to remove the project from Eclipse. The project will disappear from the Package Explorer.

Can I delete bin folder in Eclipse?

It is possible that the folder is locked and you are unable to delete it. Restarting the computer will release the lock and you can delete it then. If you replace the bin folder by a bin file, the culprit may show up.


2 Answers

I see this semi-regularly on Windows. I think it's a bug or race in Eclipse, maybe a race with a virus checker which doesn't like a delete immediately followed by a write to the same file that was deleted. The fix I use is to use Project -- Clean from the menu bar.

@Ash is right in the comments above that you should not have resources in your output folder. To help avoid that, I always change the name of my output folder from "bin" to something more obvious like "eclipse/classes"

like image 101
Chris Dolan Avatar answered Sep 29 '22 14:09

Chris Dolan


I have this problem semi-regularly, particularly when deploying to Tomcat or such like, under Windows 7. It also happens to me with the command line version of maven as well, so it's not just Eclipse that has this problem.

The root cause is that something is holding onto a file handle. Most of the problems went away when I disabled windows search/indexing on my PC, but the problems sometimes still occur.

To track down what is going on, you need to download Process Explorer (one of the most useful programs that I have ever come across). This allows you to see exactly what is running on your PC, the files it has open, the performance of the processes, how much cpu it's running, the amount of IO it's doing etc. When you have a file that can't be deleted, you can Find->Find Handle or DLL, and enter part of the name, and it gives you who has it open. You don't always catch it in time, but often enough to know the culprit.

enter image description here

like image 41
Matthew Farwell Avatar answered Sep 29 '22 12:09

Matthew Farwell