3

I'm using NetBeans 7.0.1 & when I try to create a JAVA APPLICATION, I get an error which is: "Project Folder already exists and is not empty" .

But the fact is that project folder doesn't exist, their is no folder of same name in the directory. Any suggestions would be a great help.

Thanks in advance.

Joseph Farrugia
  • 327
  • 1
  • 3
  • 14
Jignesh Parmar
  • 68
  • 1
  • 1
  • 9
  • Show hidden files maybe? Netbeans by default does not delete the actual folder when you delete a project, but if you've checked the directory then IDK what's going on. – ApproachingDarknessFish Jan 09 '13 at 05:52
  • Yes, i have checked hidden files, actually had created just a new directory and then trying to create a new project in it, still its not allowing – Jignesh Parmar Jan 09 '13 at 06:15

4 Answers4

1

Does the problem comes out when you try to create it, or what ?

Please not that your version is a bit old.

  1. Make sure that it was always in the same directory as before .

  2. I would restart my computer & try again.

  3. If the situation persists I would upgrade to the latest version (7.2.1) and check if the problem still persists or contact NetBeans.

Joseph Farrugia
  • 327
  • 1
  • 3
  • 14
1

I my case (NetBeans 8.1 on Windows 7 x64) the reason was incorrect template file for main java class (C:\Users\_my_user_name_\AppData\Roaming\NetBeans\8.1\config\Templates\Classes\Main.java). You see, when tweaking with that file I left it filled with invalid code; a closing tag was missing, to be exact. As soon as I realized my mistake and corrected it, everything went back to normal and has been working perfectly ever since.

This is what I'd suggest:
Step 1: See if you can create a new project in a folder that doesn't exist yet. Suppose the IDE does make this new folder for you, starts filling it with files, then stops unexpectedly and says that 'Project folder already exists, etc'.
Step 2: Look inside the folder and try to locate the main class for your application (e.g., C:\My_Amazing_NetBeans_Projects\MyNiftyJavaApp\src\myniftyjavaapp\MyNiftyJavaApp.java)
Step 3: If the main class file does exist but is totally empty (0 bytes in length) it might mean that something prevents the IDE from filling it with automatically generated code (as happened to me because of the invalid main class template).

In short, try to locate exact point at which the IDE loses its head. As a last resort, consider reinstalling NetBeans. Admittedly, this solution is crude and inelegant but people all over the world report it usually helps...

Igor Soudakevitch
  • 671
  • 10
  • 19
0
<#if package?? && package != ""> 
package ${package}; 
</#if> 

/** @author ${user}  */

public class ${name} { 

    public static void main(String[] args) { 

    } 
}

It seems that the first three lines of code above are key to this problem. I changed my JAVA MAIN CLASS template and removed unwanted comments, but I also removed these first three lines of code. The first project created was ok, package was "default package".

When I tried to create the next project I got an error about a Project folder that already exists. I did uninstall/install NetBeans 8.2, changed template again in the same manner, and again second project fails to create.

Then I decided to change template line by line to see what is going on and guess what: the first three lines are necessary - new projects are created well and package is not default anymore!

mystic007
  • 3
  • 2
0

I changed my JAVA MAIN CLASS template and removed unwanted comments, but I also removed something important that i didn't noticed.

i uninstalled and reinstalled the NetBeans program and then i go to:

options/templates/java/java main class/

this is at the up rigth corner in net beans. and then i selected the option that said "recover to default". then i just close and open the Netbeans again and whwen i tried to make a new project it worked.

basically you just need to recover to fefault the java main class that locates in templates options of java.

Im from mexico and my english is not so good but, I hope my answer can help some body.

enter image description here

Giorgio
  • 1,973
  • 4
  • 36
  • 51