Netbeans says the newly created file already exists, the file is empty

So using Netbeans for a small Java project. In any case, this morning he worked perfectly. Then, after a short work on another project and switching, something changed.

Now, when I create new .java files, he says that they already exist, but until then they did not. That is, the file name does not exist, and as soon as I did this, he said that it already exists, and after that he says that it is. Which, well, the file did not exist before, so this is a problem.

Secondly, the created file is empty. It is much easier to use when it creates it using a template: it automatically adds the package operator and class structure.

This is preserved upon reboot.

It sounds something like this: Netbeans creates a file and then complains that it already exists

On Windows 7. Netbeans Version 7.3

Any ideas how to fix it?

EDIT:

I think I might have found a reason. I changed the default class template, or rather, took several default sections. Apparently, the second time I did this, I also deleted some template markup, and it was this syntax error that ended up happening. After correcting the syntax error, it works.

+6
source share
1 answer

I had a similar experience: Each time I right-clicked in Netbeans 8 to get a new class in the package, I received only an empty file and a complaint that the file already exists.

The solution for me was to go to Tools → Templates → expand the Java folder → select “Java Class” → click “Restore to default”

+3
source

Source: https://habr.com/ru/post/950434/


All Articles