Reputation: 823
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?
Upvotes: 53
Views: 71037
Reputation: 63
I went to the Java Build Path ->Source (tab) ,changed the path of the Default Output folder to some other folder like customerConfig/bin to customerConfig/bins ,did a build , the error went away and then went back and changed it back to customerConfig/bin
Upvotes: -1
Reputation: 4130
This issue came to me when permission of the project directory are changed. Make sure user has write permission to the Project directory. If there are no permission to write to Project directory then eclipse will fail to delete/create Bin folder.
To Resolve it, I gave write permission to Project directory.
Ex: sudo chmod -R 777 /MyProject/code (In my case I used Ubuntu, according to OS make sure you give write permission)
Upvotes: 1
Reputation: 402
Update Spring Boots!
I had the same issue where my spring tool suite threw this error[Windows 7] whenever I make changes to the JSP or resources(css, js, images). It would allow one time save though to reflect the changes but the second time, STS would throw the error that it could not delete the file that I changed [basically could not move the file to bin folder]. I have to stop the application, do project -> clean for the error to go, make the changes and have to start the application. Process explorer said that javaw
is having the handle on bin
directory.
I tried all suggestions that are listed as answers - Recreated the workspace, checked project references, updated my Spring tools suite, disabling windows search, indexing, etc. But none worked.
Finally I updated my spring boots from 1.4.0 to 1.5.4 and the error disappeared. So if any of you using Spring Boots facing this issue, check your version and update. You may also need to add spring-boot-devtools
to enable hot-swapping with the latest spring boots versions.
Upvotes: 0
Reputation: 27958
I fixed this by disabling windows search indexing. I seem to remember quite a while ago I tried to search my project folder using windows file explorer. I guess windows has kept it's search index up-to-date since then by scanning the folder and is now bumping heads with eclipse clean.
To disable:
Since windows search is broken, I don't use it anyway. I use agent ransack for searching.
Upvotes: 0
Reputation: 244
It works for me:
Upvotes: 0
Reputation: 1204
1 - Clean your project by going to Project -> Clean.
2 - Make sure you check Project -> Build automatically.
But before that, check the permissions on the src and target folders of your project, eclipse needs to read and write to those folders, then release the permissions for it. Your problem will be solved.
Upvotes: 1
Reputation: 635
I just had this problem and it was TGitCache.exe locking the bin folder. If you use TortoiseGit, just kill the TGitCache.exe process and you should be all set.
Upvotes: 2
Reputation: 3326
Sometimes it can be resolved simply by cleaning the project and rebuilding it. This worked for me just before.
In addition, clicking 'Build Automatically' in the 'Project' tab is usually more convenient for resolving minor problems.
Upvotes: 0
Reputation: 41
Just hit myself with same problem: could not clean / rebuild Eclipse project, because my classes output folder could not be deleted.
I closed Eclipse and tried to delete the folder. Windows complained it is used by other application.
Being on Windows, I run resmon.exe from Windows / Search bar. Then going in CPU tab / Associated Handles I search for that folder path and I found handle for it from OUTLOOK. I sent a mail with a file from that path and it seems OUTLOOK kept it. After deleting the handle entry, everything worked again.
Upvotes: 0
Reputation: 10003
just adding to the knowldege base. i've had this problem. restarting eclipse or windows did not fix it.
deleting .metatdata/.lock in the parent directory after closing eclipse did fix the problem. iirc, sometimes you need to reboot windoze.
Upvotes: 1
Reputation: 45
Solution (for me): In my case the file was no longer existing wherever it was linked from, hence the file could not be found ( obvious ). All of the files being referenced are in paths in my src folder somewhere or in other local projects. Nothing so far has worked for me except the following...
How I was able to remove my broken links.
Link removed.
This is a dirty workaround. I do hope that this issue is resolved however.
Upvotes: 1
Reputation: 21
I was working on an open source project, and this particular problem was a real pain in the ass and ended up wasting 4 hours.
What eclipse is trying to say is:
I do not have access rights to the particular bin folder. If you are using linux, then:
Upvotes: 1
Reputation: 21531
I followed these steps to get rid of this:
cheers... That's it..
Upvotes: -1
Reputation: 9492
Process Explorer showed that the Android Java .jar file that could not be deleted was used by javaw, a sub-process of Eclipse...
This seems buggy.
The workaround is to close Eclipse and delete the file from Explorer...
Upvotes: 0
Reputation: 141
What works for me :
bin
folder and delete all the contents (not the folder itself).Project -> Clean
.Project -> Build automatically
.Upvotes: 14
Reputation: 833
I had to end chromedriver before I could clean my project. There were processes in the task manager that needed to be closed.
Upvotes: 0
Reputation: 366
I have been having this problem quite a bit recently. I realised it started happening after I set the workspace to automatically reload all resources from disk. This can be configured from the menu: Preferences > General > Workspace.
Upvotes: 1
Reputation: 261
I haven't read all the previous replies, but I also have the same issue. I'm running Eclipse 4.1 on Ubuntu 12.10, 64 Bit, and a SSD. I realized that this deletion issue always comes up when my computer crashes with an opened Eclipse. I managed to solve the issue by deleting particular index files. For example, my workspace log file (located at /.metadata/.log) was full with EOFException, saying that some metadata could not be read, such as
!ENTRY org.eclipse.ui.ide 4 4 2012-12-13 13:25:35.988
!MESSAGE Problems occurred refreshing the selected resources.
!SUBENTRY 1 org.eclipse.core.resources 4 567 2012-12-13 13:25:35.988
!MESSAGE Could not read metadata for '/home/xyzworkspace/.metadata/.plugins/org.eclipse.core.resources/.projects/server-test/.indexes/7/9c/properties.index'.
!STACK 0
java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:250)
at org.eclipse.core.internal.localstore.Bucket.load(Bucket.java:298)
at org.eclipse.core.internal.properties.PropertyBucket.load(PropertyBucket.java:258)
at org.eclipse.core.internal.localstore.Bucket.load(Bucket.java:274)
at org.eclipse.core.internal.localstore.BucketTree.internalAccept(BucketTree.java:98)
at org.eclipse.core.internal.localstore.BucketTree.internalAccept(BucketTree.java:109)
at org.eclipse.core.internal.localstore.BucketTree.internalAccept(BucketTree.java:109)
at org.eclipse.core.internal.localstore.BucketTree.accept(BucketTree.java:76)
at org.eclipse.core.internal.properties.PropertyManager2.deleteProperties(PropertyManager2.java:102)
at org.eclipse.core.internal.properties.PropertyManager2.deleteResource(PropertyManager2.java:111)
at org.eclipse.core.internal.resources.Resource.deleteResource(Resource.java:918)
... here goes the rest of the stack trace...
After deleting this particular index file and restarting Eclipse, everything worked as before. Any feedback whether the suggestion worked is appreciated.
Upvotes: 0
Reputation: 41
It is a Windows 7
problem. We generate a lot of code here and face the same problem when generating code
[two-step:
Explorer.exe
, intervenes. This only happens one time out of 200.On Linux and Windows XP, we neither have the problems in Eclipse nor generating files.
And we do face the problems even if running code generation and Eclipse as administratör.
We've asked Microsoft for support, but the suggestion we've had so far is "Reboot!". Hopeless!
Upvotes: 4
Reputation: 11
The process I followed is
Upvotes: 1
Reputation: 61695
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.
Upvotes: 24
Reputation: 1849
I had a similar problem with windows XP/Vista. In my case the total length of the file was more then 255 characters long.
/abcd/abcd/abcd/abcd..../abcd
The only solution I found was to rename the directories to make it shorter then 255 characters.
/a/a/a/a/a/a/a.../a
After that you can delete it. It is a restriction in the windows API. The file system can manage more then 255 characters but not the explorer which uses the windows api.
Upvotes: 2
Reputation: 2565
On windows, i've opened eclipse with Admin privilige. The problem has gone.
Upvotes: 0
Reputation: 5101
Check if any other process is using a file within the target "bin" folder, and kill it. Typically this happens with other Java processes invoked from Eclipse.
Upvotes: 2
Reputation: 1847
I had the same problem. After restarting Eclipse, one delete goes through for me and then subsequent deletes fail. What I finally did was restart Eclipse then Ctrl + click every item I wanted to delete. Then I deleted them all at once and it worked fine.
Upvotes: 0
Reputation: 11
This just happened to me. I had User Access Control (UAC) turned off when it happened (windows vista 32 bit). I turned UAC back on, rebooted vista and then the error went away. Counter intuitive that with UAC turned off, delete of the bin/net directory fails, but with UAC back on it works. Go figure.
Upvotes: 1
Reputation: 11
I just had this issue ... and it was due to the fact that I had a command line session (DOS screen...) open in a folder in the BIN tree for the project I was building ... I wanted to run the .class file via command line.
Solution was simply to cd back to the bin folder so that the "clean" could remove and recreate those target folders.
Upvotes: 1
Reputation: 75346
Problems with deleting things for me under Windows usually come down to one of two things:
Upvotes: 3
Reputation: 8963
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"
Upvotes: 29