Is there a way to stop NetBeans scanning projects?

2020-02-02 06:29发布

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?

标签: java netbeans
21条回答
在下西门庆
2楼-- · 2020-02-02 06:55

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"

查看更多
ゆ 、 Hurt°
3楼-- · 2020-02-02 06:56

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.

Plugin to control when the NetBeans IDE reacts to changes and when it ignores them. Useful addition to compile on save with additional user actions - by putting the IDE into suspended mode, one can perform (and finish) command line operations and only then turn the IDE on.

The code for the plugin is in main/contrib repository. The plugin can be downloaded from media:Org-netbeans-modules-masterfs-suspend.nbm‎ and installed (Tools/Plugins/Downloaded) into NetBeans 8.0, 8.1, 8.2.

enter image description here

After installation a new icon appears in the toolbar which one can click to suspend the automatic refresh done by the IDE. Very useful when working with Truffle sources in NetBeans 8.2 and newer.

This module is a handy replacement of previous ScanOnDemand module.


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.

查看更多
太酷不给撩
4楼-- · 2020-02-02 06:56

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.

查看更多
登录 后发表回答