Reputation: 14974
This refactoring function in Eclipse for package names used to work for me fine until... today:
This is the first time I am receiving this weird Refactoring error, and I have no idea what to make of it:
An exception has been caught while processing the refactoring 'Rename Package'.
Reason: Problems encountered while moving resources.
Click 'Undo' to undo all successfully executed changes of the current refactoring. Click 'Abort' to abort the current refactoring.
What could possibly explain this sudden "change of heart" and how do I fix it?
Upvotes: 10
Views: 23652
Reputation: 1
Check if the folder location is open in the Command prompt. If yes, then close it and try again.
Upvotes: 0
Reputation: 65
I just restart the computer and start STS(Spring Tool Suite 4) and delete the file/class its works for me.
Upvotes: 0
Reputation: 31
If it is the problem because of case. I have successfully tried a solution.
org.xyz.fileName ---rename---> org.xyz.filename
org.xyz.fileName ---rename---> org.abc (rename the structure)
org.abc ---rename---> org.xyz.filename This will work fine!
Upvotes: 0
Reputation: 4001
Same refactoring problem occurred to me when I was working in the Ubuntu. The cause is the permission limitations. Eclipse cannot re-factor as it does not have permission. After giving root permission, refactoring worked fine for me.
Upvotes: 0
Reputation: 41
Got the same error. It turns out that my ClearCase (version control) plugin was inactive. Simply activated the version control plugin, and the problem was solved.
Upvotes: 1
Reputation: 803
This can be caused if using characters like underscores in your class names (e.g. My_Class.java). The project will build and run fine. But in Eclipse, if you run Android Tools > Rename Application Package, the rename will fail.
Upvotes: 0
Reputation: 162
Seems from your snapshot that you are running windows 7, maybe vista. If its not a renaming issue, try running eclipse as administrator. It might be permissions-related, but its just a thought.
I see merit behind what Kurru is saying. Windows is not a case-sensitive operating system, meaning that is sees the words Cat and cat as the same thing. When you rename your package, Eclipse creates new directories/folder to put the package in. If you changed the case of your words and not actually rename it, it could throw this error.
Upvotes: 8
Reputation: 14331
If you're just trying to rename a package to the same name, only with a different case, this error is thrown for me. Very annoying when trying to fix package names to the lowercase convention.
Had some success renaming packages to a step folder, then to the target folder...
ie.
APackage -> apackage FAIL
APackage -> APackage2 -> apackage SUCCESS
Upvotes: 4
Reputation: 75406
Under Windows this is frequently caused by a file or directory being locked. There can be several reasons for this:
If this is the behaviour of a freshly started Eclipse on a freshly started machine, it is probably not Windows, but a corrupted workspace or Eclipse distribution, and you should unpack a fresh Eclipse and create a new workspace in which you can import (and copy) the existing projects from the old workspace. I don't think this is the problem, though.
Upvotes: 5