Unable to rename or delete file in eclipse - eclipse

I am very new to eclipse, and within a project I am trying to rename/delete a file. Running eclipse under ubuntu, I right-click on a file in the 'Project Explorer' windows, and a zillion of possibilities pop up. But when I use 'delete' or 'rename' on this file, noting happens. Neither can I rename the file, nor can I delete it.
Is this a bug or a feature? How can I rename or delete a file from within eclipse? Why does it not work?
P.S. I am also not able to delete a project the same way. How to delete an eclipse project?

Check permission of project directory. if you don't haven't write permission this could happen try to run below command in terminal for project directory it will give read write permission to all users.
chmod 777 -R "yourprojcetdir"

Related

Eclipse: The project was not built since the source file ... could not be read

When compiling my Java project, I get this error in Other errors:
Description Resource Path Location Type
The project was not built since the source file /PROJECT/src/main/org/../ABC.java could not be read PROJECT Unknown Java Problem
Indeed, the file is listed in Package Explorer but shows only "Error retrieving content description. On the file system, the silent dir exists but not the file; git status is missing nothing. How do I resolve that compile error?
Simply restart eclipse, refresh all projects and do a clean build. That should fix it. Don't forget the eclipse restart, else no matter how many times you do a clean build or refresh, it will not fix the problem
Looks like someone has deleted that file but eclipse still think that file is part of the project. Might have happened when someone deleted a file from the source control in an improper way.
If you dont have pending changes then you can get fresh copy of the project and import it into your workspace.
If you have pending changes then take a copy of changes and repeat above step. ( A restart of eclipse may be necessary)
It can be related to missing location
Select File => properties => Resource => Edit file location.
I know the answer is accepted but in my case that solution didn't work for me, I had restored files from a backup to my local project in linux and the files I restored were owned by root with only the owner being able to read/write the files. SO, I sudo chowned the files "sudo chown _R myUser:myUser *" at the base of my project, refreshed in Eclipse (f5) and the annoying repeated failure of my build was a thing of the past.
If you are writing Maven projects, try right click on the project and select [Maven] -> [Update Project...]
It works for me.
For me there was a different solution than mentioned here.
I was doing a no-no, I imported a project that had a .project file, and there was some errors in the way my version of eclipse was reading some of the files. The package names and files had a little ! symbol with a yellow background.
The solution was to delete the packages. Obviously make a backup. But in doing this most times the files nor the packages were deleted. Instead eclipse refreshed and the desired files were there. Sometimes I had to hit refresh (F5), and sometimes I had to restore files.
I found it best to delete the packages as that is where eclipse was having reading the data.
If the missing file is still mentioned in the Linked Resources, no refresh and restart of Eclipse will ever solve the problem. You have to delete the file in the Project Properties Linked Resources list.
For anyone using VS Code with the RedHat Java plugins (which use Eclipse tooling under the hood), I got this error as well. I fixed with the following:
# Quit VS Code
rm -rf ~/Library/Application\ Support/Code/User/workspaceStorage/*
# Reopen VS Code
As all others said, it is most probably an issue with the internal caches of Eclipse.
I usually restart the IDE with the additional -clean option to wipe out the OSGi-related caches, then clean and rebuild all the projects.
If the problem persists, I realized that cleaning up the single affecting project works better that cleaning up the whole workspace. (Ominous... XD)
This usually happens to me when merging changes that imply renaming or deletion of source files, prior to launching Eclipse.

"Sources directory is already netbeans project" error when opening a project from existing sources

I've installed NetBeans 6.9.1 and installed few updates for it.
Then I've created a new project from existing sources. After a few changes I've closed it. And now I am having an error, when trying to open a new project from existing sources (the same files):
Sources directory is already netbeans project (maybe only in memory).
After Googling it, I noticed it happened not only with me. But I didn't find the correct solution. I've tried to restart the IDE, I've tried to restart the PC, I've tried to reinstall NetBeans. Nothing helped.
Thank you!
I was having the same problem:
Sources directory is already NetBeans project (maybe only in memory).
Netbeans creates a folder in your project named "nbproject". Once you delete that, restart the IDE and you're good to go.
When you create a NetBeans project from existing sources, NetBeans uses the same directory to add its own files: a netbeans folder with .proj files.
Solution: delete the netbeans folder and restart the IDE. Opening a new project should now work.
Go to the folder containing your project
Delete the folder named nbproject
Restart Netbeans
Try creating your project again from the original folder
This means the project folder is already a netbeans project. So instead of adding it as a new project open it as
This happens(i believe) because netbeans tries to version control the files created or edited.
Under the project folder netbeans create a netbeans directory just delete it . This has been tested in Ubuntu. Then you can import your project if php then php using existing sources.
Click File >> Recent Projects > and you should be able to use edit it again. Hope it helps :)
On Windows at least none of these answers work (for me anyway!). I have found the only way is to copy an existing netbeans project folder in to your new project and manually edit the xml project name.
I also opened the private/private.xml and removed the open files xml just incase these caused problems.
Once I'd done this the project works as normal.
I checked the "Put NetBeans metadata in separate directory" tick and it works fine.
This is in 2. Name and Location after you choose PHP from existing source
In my case my project root directory consists ".project". This contain the XML reference of the project name.
By removing this, i am able to create a project.
Usually this happened when we copy source code of a already created project and copied in different folder and try to create a project from it. as netBeans create its folder nbproject in our project folder this folder also get copied with our source code and it give error "Sources directory is already NetBeans project (maybe only in memory)" remove this folder from you newly copied folder and voila you can create a new project.
If this is your own source code and you already have a Netbeans project folder with your source files you should just start with:
File | Open Project...
not
File | New Project ...
because the project is not new.
If it helps anyone else, I had the same problem and the solution was to reinstall NetBeans.
I had tried all sorts of fixes: Deleting the NetBeansProjects folders, checking/unchecking "Put Netbeans metadata in a separate directory", killing/restarting NetBeans, restarting the system, etc. Nothing cleared the message...except the reinstall.
The advice here about removing the nbproject directory is not quite the whole story.
What Netbeans seems to do (and we are guessing at reverse engineering here) is to look for an xml file which has opening and closing project tags in it. This it concludes is evidence of an already existing project. Now if your files have an nbproject directory there, that will contain a project.xml file which contains the said tags. So removing that will do what you want.
But, my files don't have a nbproject directory but still NetBeans tells me there is an existing project maybe in memory. The reason is: my files include a file called pom.xml and that contains the said project tags in the xml (it was created by an entirely different system). Once that xml file is removed, then NetBeans will create an html project for me importing my code.
In sum: look through any xml files in you existing code, and be wary of project tags.
This happened to me when I tried to import an Eclipse project in a brand new NetBeans 7.2.1 install on Ubuntu 12.04LTS.
I mistakenly selected the import projects from workspace (the first option in the import wizard's opening pane) on the first attempt, and it opened the project in the original Eclipse workspace path (which was on a usb stick).
From this, I then realized that I actually need the second option - import project ignoring project dependencies, which lets you specifically choose source and destination folders. After closing the project, I tried to import again with the proper option, but it didn't work.
From then on nothing I did helped - restart the IDE, move the source folder, nothing. There was no nbproject folder in the project or /var/cache in the user folder to delete (in-fact there was no nbproject folder in the whole file-system).
Since restart didn't work, I'm guessing that there is a garbage project entry somewhere which Nb reads (See Martin Frické answer above).
After googling along the lines of 'netbeans clear memory project cache' with no success, I opted to reinstall NetBeans -
sudo /usr/local/netbeans-7.2.1/uninstall
sudo ./netbeans-7.2.1-ml-javase-linux.sh
which solved it.
If you are on a Mac, press command shift G and in the box type /users and then go, next click on your user name and navigate to netbeansprojects and open it. Then delete the ones in there that are causing problems. You can then create your project.
Note: I had moved my wordpress folder to my desktop trying to figure this out, so I dropped it back into the origional location and it works fine. So if you did this, just replace the wordpress folder after deleting the problem projects from the netbeansprojects folder and its contents back to the original installation folder.
Hope this helps...:)
This is what I did to solve this error:
1) I copied a folder named "folder1" (and I called the new folder "folder2"). "folder1" was a Netbeans project so it had a folder called "nbproject" inside it.
2) When I tried to create a project out of the "folder2", Netbeans threw an error "Sources directory is already netbeans project (maybe only in memory)."
3) Inside Netbeans delete the project of "folder1". Then, delete the two folders named "nbproject" (one is inside "folder1" and the other is inside "folder2").
4) Inside Netbeans, create two new projects: one for "folder1" and another for "folder2". The error should not appear anymore.
copy an existing netbeans project folder in to your new project and manually edit the xml project name.
reinstall netbeans
copy/move all files/folders (except nbproject/ folder) to a new folder for your project, with a new name.
Try to create a new empty project; then you can copy the public_html to the new project folder and it will appear .
I faced the same issue:
Sources directory is already NetBeans project (maybe only in memory).
The solution is:
Netbeans creates a folder in your project named "nbproject". Once you
delete that, restart the IDE and you're good to go.

RubyMine Folder Tree doesn't refresh

Using RubyMine 2.0.2 for the first time today, on Mac OSX Leopard. If I create files in the filesystem (with, say, script/generate) those new files do not appear in rubymine. I have had limited success with restarting the program, in that the files in the db/ folder are added and removed, but unfortunately new folders in the views directory are not shown.
Pardon my french, but wtf?
Thanks
I'm experiencing the same, couple of things seem to work ...
Close rubymine, delete the .idea folder ...
sudo rm -r .idea
(if macos or linux)
... and restart until they fix it
AND/OR
In Rubymine, Go to File > Open Directory > navigate to the directory or file that you require, this should refresh the view, don't add the .idea folder to git ( if you're using it )
Not great, but you can get round it
If you right click on a directory in the Projects tab, there is an option for "Synchronize". Click it and RM will show all files, sub-diretories etc. again.

Retrieve/Recover deleted Netbeans project

I was just working on my Netbeans project and accidentally deleted it and don't know how to recover it.
Is there a tmp folder that the deleted project is stored in.
Or am I forever doomed?
Thanks,
Lucas
Do not panic. Its very easy. Follow the steps:
Right click on the folder/directory that the files had been deleted.
Choose Local History – Restore Deleted
Done
If you accidentally delete a folder on Netbean, the way to recover it is as follows. You can't revert deleted folders but you can revert deleted files. Follow these steps.
Recreate the folder you deleted in your Netbean project. (You may not be able to create the folder within Netbean, in that case you can use mkdir command to create the folder )
Right click that folder in Netbeans and go to History -> revert deleted (you should see a list of deleted files that relate to that particular folder.
Repeat for each folder and sub-folder
Note: I do not know if this works on windows, I know it worked for me on Linux. I also don't know if this works after you have closed Netbeans.
hope it helps someone.
You have a problem of package/directory/file deleted in netbeans?
Don't panic it is simple just:
open your netbeans IDE
go to projects
go to the package where your project folder was
right click on it
go to local history, then go to revert deleted
it is done. Wait a moment!
I think it will help you.
Enjoy your code please.
http://www.recuva.com/
saved me countless times when I first started with Visual C# opening the IDE and making mini programs without saving. All your files are stored in a temporary folder and exiting Visual C# wipes them. Just do a recuva scan and sort files found by modification time. Deleted files are recoverable, overwritten files however are a different story, so run the program as soon as possible.
Actually, easier then trying to load a project that does not exist in the project explorer of netbeans.
If you still have the files locally, just choose Open Project and your lost project will be restored to the Project explorer of netbeans.
I don't know if there is a temp folder. Windows search engine doesn't work to find it. If you delete the source file by using safely delete;
On Netbeans Refactor-Undo[Safely Delete] option can be used to recover...

Problems committing file to SVN repository

I have a maven pom build file in the root directory of my project. When trying to synchronize with SVN repository from Eclipse (Europa), red double directed arrow is being added to the file icon. This means that both my local copy and the one in the repository have been changed since last synchronization.
When I try to do do 'Override and update...' error message is being thrown:
Some resources were not reverted.
Attempted to lock an already-locked dir
svn: Working copy 'C:\Java\workspaces\pro\myProject-TRUNK' locked
Do you have an idea what should be done in this case?
svn cleanup ?
not sure how you'd do that from eclipse though ... but if its a standard svn working copy, you should still be able to do it with another tool.
In Eclipse, to do SVN clean up
Right Click on Locked Project -> Team ->Cleanup
delete the .loc and .log files from the directory if Team->Cleanup is not available to you from subeclipse and update the resources giving you the error message earlier.
It looks like the repository has got a bit confised! You could try a 'svn cleanup' in the project directory.
You can do it on the command line, or using a different tool...
From the command prompt, you'll have to have subversion installed and on the PATH. Close Eclipse, open up a command prompt and cd to the root of the project, then type 'svn cleanup'.
You could also use Tortoise SVN to do the same from Windows Explorer. Install Tortoise SVN and close Eclipse. Within Windows Explorer, navigate to the parent of your project directory, right click on the project folder and select 'Tortoise SVN' -> 'Clean up'
This normally happens when you paste a directory into another in your project.
You have to create the directories manually, then paste all the files.
To solve the issue:
Right click on the project (or on a parent directory)
Then team
Then clean up
This happens if we have some pending sessions on committing our changes so we’ll need to do some clean up before we’ll have another try on committing our changes. This is how to do it.
Click to Team->Clean Up
Try again to commit..
it's working for me.
add svn application
sudo apt-get install svn
cd <folder-project-name>
svn cleanup
Restart your eclipse (IDE) . Problem Solved.
I went to local svn folder and removed the log file and lock files did the svn update from eclipse and everything back on track
Right-click on project-->Team-->Refresh/Cleanup
Right click and select Team->Refresh/Cleanup
I see Team -> Cleanup in most answers- somehow did not work for me.
I did this -It happened twice for me.
Once I resolved Like this -- I made a backup file with my changes . I closed my eclipse -> go into the prject in windows explorer - > Go to the file in conflict -> right click -> SVN -> Revert. Now I started eclipse -> put back my changes and it worked.
Second time it happened -- That did not help. So, I had to delete the project on my eclipse workspace, and checked out the project from SVN and it worked.
-Hope it helps.
Use TortoiseSVN -> Release lock -> Break lock