68

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.

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Dmitry
  • 835
  • 1
  • 8
  • 12

19 Answers19

147

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.

user294382
  • 1,709
  • 3
  • 10
  • 8
  • 11
    This is the real solution to this problem! – King Julien Oct 27 '12 at 13:31
  • 1
    Have in mind that if you are working with someone else on the same project, the nbproject folder might be the other person's project. Deleting it will mess up his history and settings. A way around it is to select a different folder for your project files (the field after the project source folder) – DreamWave Sep 26 '13 at 10:30
  • 9
    Yes, especially the "RESTART IDE" is key after deletion of "nbproject" , even if not opened in Netbeans at all. – tomg Mar 14 '14 at 11:12
  • 7
    Do not forget to restart netbeans after deleting the nbproject folder! – Raphael_b Aug 01 '15 at 14:58
  • Restarting IDE loses sate of files, means I cannot do Ctrl+z or Ctrl+r. – Umair Ayub Apr 22 '17 at 07:30
  • This works very well, especially after you restart Netbeans. The folder nbproject if not visible in windows click on view hidden files to see the folder and you delete it. – NJENGAH Jan 17 '20 at 01:07
41

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.

Andrei Duma
  • 717
  • 7
  • 10
  • Have in mind that if you are working with someone else on the same project, the nbproject folder might be the other person's project. Deleting it will mess up his history and settings. A way around it is to select a different folder for your project files (the field after the project source folder) – DreamWave Sep 26 '13 at 10:31
  • I took the "offending" project, created a tarball of it, deleted it from Netbeans, added the second project and the untarred the tarball. After untarring it, Netbeans was happy to open and use it. Works great. – Daniel Wisehart Oct 21 '16 at 16:57
  • open project and selecting the source folder worked for me. – bansi Oct 03 '19 at 09:21
35
  1. Go to the folder containing your project
  2. Delete the folder named nbproject
  3. Restart Netbeans
  4. Try creating your project again from the original folder
jonsca
  • 10,218
  • 26
  • 54
  • 62
  • Thank you! Saved my time. What an obvious solution! Forgot to delete the nbpoject folder and spent almost half hour to find the solution.. and the aswer is here front of my face :) – Andras Barth Nov 20 '18 at 17:54
15

This means the project folder is already a netbeans project. So instead of adding it as a new project open it asenter image description here

Qumar
  • 183
  • 1
  • 8
  • Is this safe to do if the sources folder is on a shared drive, and I want to be able to open the Netbeans project on different computers? – osullic Jul 12 '20 at 11:54
2

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.

Shyam Joshi
  • 387
  • 4
  • 9
2

Click File >> Recent Projects > and you should be able to use edit it again. Hope it helps :)

madi
  • 5,612
  • 5
  • 36
  • 48
1

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.

Simon
  • 26
  • 4
  • Thanks, simple but the trick is to come up with the idea. I was struggling a lot with this, testing a lot of answers here, but this was the only solution for me. Also on Windows (7) – 244an Jun 23 '18 at 13:09
1

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

Bor
  • 775
  • 3
  • 19
  • 44
1

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.

Drew
  • 24,851
  • 10
  • 43
  • 78
jaip
  • 31
  • 5
0

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.

eh1160
  • 674
  • 1
  • 6
  • 14
0

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.

Grant Winney
  • 65,241
  • 13
  • 115
  • 165
0

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.

Chorel
  • 362
  • 1
  • 13
Ady Rosen
  • 33
  • 5
0

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...:)

Amy
  • 1
  • 1
0

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.

pablofiumara
  • 1,747
  • 1
  • 16
  • 24
0
  1. copy an existing netbeans project folder in to your new project and manually edit the xml project name.

  2. reinstall netbeans

  3. copy/move all files/folders (except nbproject/ folder) to a new folder for your project, with a new name.

zipit
  • 1
0

Try to create a new empty project; then you can copy the public_html to the new project folder and it will appear .

0

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.

Jaideep Ghosh
  • 634
  • 8
  • 11
0

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.

Pankaj Khairnar
  • 3,028
  • 3
  • 25
  • 34
0

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.

Jannie Theunissen
  • 28,256
  • 21
  • 100
  • 127