Projects cannot run in eclipse because of deleting the whole .metadata folder by mistake - eclipse

I delete the whole .metadata folder by mistake, so my projects in eclipse cannot run at all, and there is no backup for .metadata folder. what should I do to fix this ?
Thanks!

If you don't have too many projects you could do this:
Open eclipse with the same workspace as before.
Create a new project with the exact same name and working directory as your previous project.
Repeat step 2 for each project.
Eclipse will find the files, but if you had any additional settings you might have to add them manually.

Related

How to undo an Eclipse workspace

Is it possible to undo an Eclipse workspace without deleting the whole directory? By this I mean to keep the projects in the same directory but the directory should no longer be a workspace.
There is no Eclipse option to do this but you can do a reasonable job by deleting various directories and files in the workspace:
The .metadata directory holds most of the Eclipse data. Deleting this will stop Eclipse recognising the workspace.
In each project deleting the .project file will stop Eclipse recognising the project as a project.
You could also delete the .classpath file and any .settings directory in each project. Some types of project may have additional files that can be deleted.
If you want to keep the projects as eclipse projects then just deleting the .metadata folder is enough (for some eclipse packages, one or more of the projects may also be eclipse generated and could be deleted, so any projects not recognized can be deleted). Now, eclipse needs to run with a workspace so when you start eclipse with a fresh workspace, you can import the projects from the old workspace folder but don't select the import option which gets the projects copied into the new workspace.
In this way, your new workspace will just have metadata for the workspace but the projects themselves will stay in the first directory.
(Strictly speaking, you don't need to delete anything from the old workspace directory. Instead, simply don't select it as a workspace when starting eclipse. However, deleting the .metadata folder would get rid of unnecessary data.)
Note that if you delete the .metadata folder and then later want to use the directory again, as an eclipse workspace, you can just select it when starting eclipse. However, in this case, the projects will not be automatically recognized as being in the workspace (even though they are in the directory), since that information was in the .metadata folder. To get them recognized again, as projects, you will need to import them, though you won't need to set the copy option in the import wizard.

Why do projects that I add to my 'workspace' folder don't show up? [ECLIPSE]

I am using Eclipse Indigo, and after having successfully extracted my project folder into my Eclipse workspace, it does not show up in the package explorer. I tried refreshing eclipse and restarting it, to no avail. I am 100% certain my eclipse is using the right directory and the project is in it.
What could be the problem? Thank you.
EDIT: "import projects into workspace" worked for me, but why was that necessary?
Files in the directory are not automatically picked up by the package explorer. You need to import them.
Try using the File > import, then choose
Existing Projects into workspace.
There is a checkbox that says "Copy projects into workspace" which copies it to your workspace if it happens to be in a different folder. If you start with your files in another folder, you'll see how it's copied and set up with configuration files in your workspace directory.
To answer the question, "why is it necessary to import?" you have to realize that the Eclipse workspace is just a logical container for projects, not necessarily the physical container for them.
Also realize that a directory of project-related files does not make an Eclipse Project; Eclipse must be given or generate it's own set of configuration in order to understand a project (minimally, for Java projects, .project and .classpath). Without those, Eclipse has no idea what to do with an arbitrary folder that you call a "project." That's what the Import or Create Project wizards are doing under the covers, generating those config files.

Getting "Project folder ins managed by a project..." when opening Actviti source code in netbeans

I can't open Activiti source code in netbeans It just says "Project folder is managed by a project Activiti. Instead of creating a new project just open it. If by a chance you just deleted the project Activiti then restart the IDE to reuse the folder."
I have restarted Netbeans and re-cloned the project but it still won't open.
And eclipse just says that the javac was not found in the build.xml.
Any help would be greatly appreciated.
The project folder does not contain a nbproject folder.
Try the following:
rename the pom.xml file to something else, e.g. pom.xmlzzzz,
create the project in NetBeans,
rename pom.xmlzzzz back to pom.xml once the project has loaded in NetBeans.
I've just hit the same problem with a different project and this is what fixed it for me.
Netbeans creates a folder in your project named "nbproject". Once you delete that, restart the IDE and you're good to go.
Go to the folder containing your project
Delete the folder named nbproject
Restart Netbeans
Try creating your project again from the original folder

Restore Eclipse Workspace

I zipped my whole workspace once in a while and want to reanimate it now. Some stupid sync crashed my current state. What I tried is to unzip it and then changed the workspace of eclipse to the newly generated folder.
The problem now, my Eclipse is blank containing now projects at all, the Package Explorer is empty, even after pressing F5? Any suggestions?
Do I have to use same Eclipse Version, which I used when producing the zips? Does a Computer change from 32 to 64 Bit or visaversa make a difference.
Thanks in advance!
I would delete your .metadata folder and re-import the projects manually. The metadata will be automatically regenerated.
Did your zip file contain the hidden .metadata folder? (This is where Eclipse stores preferences and launch options.) If not, that may be reason why you don't see your projects as before.
You can try to import existing projects. Then you should at least see the projects again.

"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.