I don't have much memory on my PC and a pretty weak processor. Although netbeans is by far my favorite IDE it is almost unbearable to use on my present computer because of the project scanning that starts automatically when I open the program.
Is there a way to prevent netbeans from scanning projects?
I've stumbled upon this problem aswell.
The most simple thing is to edit the netbeans config so it doesn't load all your projects. you can always reopen the other projects from the menu. once all the projects you arent using are closed they wont be scanned each time you start netbeans
Solution: Just change the following line in netbeans.conf found under etc folder
# ${HOME} will be replaced by JVM user.home system property netbeans_default_userdir="${HOME}/.netbeans/changeme"
For Netbeans 8.*+, the ScanOnDemand plugin from Zeophlite's answer does not work. Use MasterFileSystemSuspend instead, as it is current and works fine on stable releases.
On a personal note, this brought my netbeans memory consumption for general use down from 20gb+ during idle to about 2gb consistently, and provides a good workaround for the scanner constantly hanging and leaking memory, particularly in very large projects or those with a ton of symlinks.
Scanning performance of Netbeans can be improved using the following procedure :
1) Go to Window-->Files. This opens the Files Tab.
2) In the Files Tab for each opened project open the nbproject folder and inside it open the project.properties file.
3) Now in this file below the property "excludes" there are file references listed for all your referred Libraries (JARs)
4) There might be some repeated file references with paths that may be old or on someone else's machine(if you are working in a group and transferred projects from someone's machine)
5) Delete those old path references.
Example -
excludes=
file.reference.xyz.jar=../not/correct/path.jar //delete this line
file.reference.xyz.jar-1=../correct/path.jar //remove -1
....
includes=**
6)Also locate the property "javac.classpath" and delete the unnecessary classpath entries corresponding to the deleted references as described above.
Example -
javac.classpath=\
${file.reference.xyz.jar}:\ //delete this line
${file.reference.xyz.jar-1}:\ //remove -1
....
javac.compilerargs=
7) So now the file reference mentioned in the file reference section and the javac.classpath property is same and points to a valid Library (JAR) address on your machine or network.
Example -
excludes=
file.reference.xyz.jar=../correct/path.jar //the correct reference & path
....
includes=**
....
javac.classpath=\
${file.reference.xyz.jar}:\ //the correct classpath entry for reference
....
javac.compilerargs=
....
The reason the above procedure worked (in my case) is because it prevents Netbeans from scanning unnecessary Library paths that may not be present on your machine/network.