Although I have not encountered these issues recently (I am currently using NetBeans 7.1.1), there are situations where NetBeans starts to behave in strange ways:
- Project scanning seems to enter an infinite loop
- Projects won't compile anymore or compilation enters an infinite loop
- Project error messages are displayed, thought there is actually no error in the code or in the configuration (for example java.lang.NoClassDefFoundError)
- NetBeans claims that code is syntactically incorrect, though it is not
- Project dependencies are not found anymore, though they are physically available on your PC
It took me quite some time to find this, but actually, when you uninstall NetBeans, this does not necessarily erase the existing cache. The uninstallation process asks you whether you want to keep your configuration. It also means keeping your cache too. Hence, since I kept my configuration, I also kept my existing cache.
It seems like all the issues described above were caused by a corrupted cache. The solution is simple and does not require you to uninstall NetBeans:
- Close any instance of the NetBeans application.
- If you are under windows, locate the C:\Users\[YourLoginId]\.netbeans\[netbeans_version]\var\cache\ directory. If you are using Unix, this would be something like ~\.netbeans\[netbeans_version]\var\cache\. (*)
- Delete it. Don't worry, NetBeans will recreate it.
- Restart NetBeans.
This always worked for me.
(*) Starting from Netbeans 7.2, the path is now: