If you encounter this problem in Netbeans, chances are you enabled the option “Compile on Save”. I do not know why this occurs because there are some cases where I enable this problem and I do not encounter the same error.
To do so, do the following:
- Right click project name, choose Properties
- Go to Build > Compiling
- Click “Compile on Save”
That should do the trick.