71

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?

George
  • 796
  • 1
  • 6
  • 6
  • 1
    Netbeans 7.2 rocks. no scanning project, but they recommend higher cpu. – vels4j Nov 24 '12 at 18:44
  • Do keep in mind that the background scanning is required for the navigator,etc. To list out all the classes , the methods, functions ,etc. – MarcoZen Apr 28 '15 at 03:13
  • 1
    @MarcoZen The thing is, I only wanted the scan to happen in specific folders... Even with only one project opened there is a huge bug in the scan that sticks it in an endless loop that burns up the CPU. Only when these are fixed: http://statistics.netbeans.org/analytics/detail.do?id=201133 http://statistics.netbeans.org/analytics/detail.do?id=201432 I may be back to NetBeans: I've tried all the solutions below, none helped... Right now I am back to Aptana/Eclipse again... – Armfoot May 07 '15 at 10:43
  • @Armfoot - let's hope things get resolved for better. – MarcoZen May 08 '15 at 13:56
  • There is indeed a very nice solution for this. Go for Eclipse or Intellij. – FuryFart May 22 '15 at 15:28

22 Answers22

57

Hey George I don't know if this is much of an answer but I right-click and choose 'close' on the projects that I don't need open. There's no point in having all your past projects listed there. Just have the one that you are developing open. You can always reopen the other projects from the menu. Once all the projects you aren't using are closed they won't be scanned each time you start Netbeans.

Charlie Brumbaugh
  • 219
  • 1
  • 5
  • 15
David
  • 893
  • 3
  • 10
  • 15
  • I usually work in the files tab and don't even look at the projects tab, just saw that a very large project was listed there with thousands of files, as soon as I closed that the scanning stopped. Thanks a lot! – George Dec 23 '10 at 03:55
  • 16
    This doesn't help if the main project you're working on is huge and you can't close it. I still have this issue with background scanning just hanging and blocking everything for several minutes. – user26270 Nov 15 '13 at 15:31
22

In addition to creating smaller Projects for the folders you really work on and then a Project Group to group them (Mateng), you can try excluding folders that you will never work on such as images folders and so on. To ignore those folders, go to:

File > Project Properties > Ignored Folders > Add Folder...

From NetBeans Help:

The Ignored Files property is the opposite of the Include Path. These are files inside the PHP project that you want the IDE to ignore for FTP upload, scanning, etc.

NomadeNumerique
  • 444
  • 5
  • 10
  • 2
    Great, this was the solution for me on a project with several gigabytes of media files. – pfrenssen Dec 05 '12 at 19:42
  • 3
    I find this as only correct answer. You can simply choose an folder with big amount of files (like img/dynamic) and simply exclude it. – Ivan Apr 23 '15 at 13:11
  • 3
    excellent, adding "node_modules" [npm] and "vendor" [composer] to ignored folder made netbeans better – Raj Kamal Feb 21 '16 at 18:47
  • 1
    This is a really good solution. It improves in a significant way the background scanning process (exclude `node_modules` for example definitely improves netbeans performances) – Sébastien Gicquel Mar 27 '17 at 10:01
  • 2
    This is the solution that works - tried the others aswell – 3und80 Jul 21 '17 at 10:37
  • 1
    I absolutely recommend this in addition to other methods for fine-tuning your Netbeans so it is the most efficient for you. This is what I use to ignore `bower_components`, `node_modules`, `vendor`, and it helps a lot. – skcin7 Aug 31 '17 at 23:48
  • 1
    There is no "Ignored Folders" in 8.2. I see Includes/Excludes button but requires impossible-to-understand regex patterns – user3217883 Jun 21 '18 at 15:05
14

Try this: http://wiki.netbeans.org/ScanOnDemand

Warning: Currently, this plugin only works with development builds. DO NOT use these instructions with an official release...

As soon as you start the NetBeans IDE, the system does so called "up-to-date check" to verify that no files have been changed. If this seems to take too long in your case, and prevents you from performing your work, you may be interested in ScanOnDemand.

The most basic functionality of ScanOnDemand is to disable (potentially long) up-to-date check after start of the IDE. This is done under the expectation that most of the operations with your sources are done from inside the IDE and thus when the IDE is shut down, no important change can happen and thus there is no need to rescan anything. Indeed, this may not be fully accurate, but the fix is easy, in the rare situation where your significantly updated your sources using other tools, just trigger the refresh manually.

Once again the NetBeans IDE gives you more control. You stay in charge, deciding what to do and when...

To help in this area, we decided to create an experimental module, which is available on Update Center (as of release 6.7). The module omits automatic updates in certain situations (e.g. up-to-date check after startup and after switch to main window). The responsibility to invoke rescan and so make the data up-to-date is on the user - via explicit refresh action...

gnat
  • 6,213
  • 108
  • 53
  • 73
Zeophlite
  • 1,607
  • 3
  • 19
  • 36
  • This is the best solution, IMO. Allows you to scan when you know there are changes, and gets out of your way otherwise. – Ian Feb 08 '11 at 18:15
  • This plugin did not install on my 7.1.1. I went through all the install steps, restarted netbeans, nothing... Netbeans did his usual scanning and when I opened my project, it did hang AGAIN at 82% in the scanning project process - for the fourth time ;( Netbeans is a big piece of crap. – Guillaume Bois Jun 27 '12 at 18:03
  • I tried this, but it prevents by IDE from loading at all. Hangs indefinitely at the "Loading modules..." step of the start process. – Joshua Burns Mar 18 '14 at 21:33
  • @Joshua , what version? – None Jun 17 '14 at 19:47
  • Looking back I believe that on the development branch, so that could have been fixed in stable releases. – Joshua Burns Jun 19 '14 at 17:40
  • 1
    I installed this plugin on Netbeans 8.0.2 and after that, the IDE didn't even open. Check out this [bug](https://netbeans.org/bugzilla/show_bug.cgi?id=248993)! I had to re-install Netbeans... – joaorodr84 Mar 07 '15 at 17:20
  • 1
    @joaorodr84 I had the exact same problem... I tried at least 2 times. – Armfoot May 07 '15 at 10:47
  • There is a stable alternative that works on Netbeans 8+, see [my answer](http://stackoverflow.com/a/42380109/1288121) – mopsyd Feb 22 '17 at 00:09
13

Stop NetBeans scanning projects :

   Menu -> Tools -> Options -> Miscellaneus -> Files -> Uncheck Enabel auto-scanning

Stop Netbeans Scanning Project

iCrazybest
  • 2,935
  • 2
  • 24
  • 24
  • 5
    Disabling this does not fix the problem, at least not always. It looks like it is supposed to but it does not. I have had that setting cleared for 2 weeks and still the scanning continues. The scanning is apparently tied to my edits, for one thing. If I change one character in one file the whole shebang is scanned again - all projects. Super inefficient. - I have to have several projects open in order to do my work. - I would dearly love to know how to do this. Why can't the NB folks just make it really stop? This has been a problem for years. Clearly not important to NB folks to make it work. – Iceberg Apr 27 '15 at 23:00
  • - I used to love NetBeans but was forced to go to IntelliJ on one project and Eclipse on a different project. Now I got the chance to come back to NetBeans and man alive am I disappointed!! - plugins are, in general, not allowed although some are occasionally approved. So I can't just throw it in to see if it helps. – Iceberg Apr 27 '15 at 23:00
  • - more memory is also not an option (already maxed), nor is getting a different computer. - the thing that made most of that scanning stop was to close the Tasks tab. – Iceberg Apr 27 '15 at 23:12
9

i know this is an old question but this may help others... To enable or disable background scanning you can find the option under menu Tools -> Options -> Miscellaneus -> Files

https://blogs.oracle.com/netbeansphp/entry/enable_auto_scanning_of_sources

8

In addition to close unneeded projects (David) you can create project groups containing related projects (or just one):

File > Project Group > New Group....

Project groups can then be opened by pointing at them from the same menu. Best of all: Each group remembers which files were open in the editor windows the last time. I organize all my projects into groups and it reduces scanning significantly.

(btw: There's a handy plugin providing a project group shortcut to the toolbar)

Edit: I am also using Scan on Demand for a while now - really good. Kudos for that answer.

Mateng
  • 3,742
  • 5
  • 37
  • 64
  • great answer, especially useful when you project is actually devided between several netbeans projects – svarog Nov 25 '14 at 08:37
3

I don't know whether you can disable the project scanning or not. Even if you can, I doubt it will ever work properly again. There are a few tips which I have done and it speed up my Netbeans.

  1. Close Tasks window. This prevents Netbeans to scan for TODO in the comments.
  2. Exclude virus scanning for *.jar, java folders and netbeans folder. This speeds up my netbeans A LOT.

Netbeans consumes a lot of memory so adding memory also increases its performance (OS does not need to swap between memory and page file when memory is running low) (but this is probably not an option for you). Also, Netbeans consists of hundreds of files which needs to be loaded at start up so the bottom neck is the speed of your hard disk.

gigadot
  • 8,879
  • 7
  • 35
  • 51
  • 2
    "2. Exclude virus scanning for *.jar.." this is setting for your AntyVirus program, not NetBeasn right ? – d.raev Jul 08 '13 at 09:49
2

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.

Community
  • 1
  • 1
mopsyd
  • 1,877
  • 3
  • 20
  • 30
2

This below solved it for me. One project when opened would cause never ending background scanning... this would also mean the code completion etc could never work. My machine was devoting a huge amount of resources to this.

Someone here gave me the clue: right click the project, choose properties, then "Ignored Folders".

Essentially I used this to determine which (specific) folder was the cause of the scanning. I selected the first half, then the second half of the remaining etc a process of elimination... and out of hundreds of folders, I found a (php HMVC view folder that caused it) ... I needed to stop and kill the scanning, then re-start many times...

Here is the easiest way for various reasons:

In the "ignore folders" area, select all the folders and add them all (fairly individually) to the ignore list. Then shut down the ide, and restart. When all background scanning is absent (it starts and runs for a few seconds/minutes normally), begin removing one or a few of the folders. After each removal, close the properties window..... the IDE will quickly scan those folders you removed and will IF no issue with those stop scanning. IF you have just removed the culprit folder, then the scanning will never end...

1

And another quick thing you can do just delete the nbproject folder inside your project then open the NeteBeans. then the project remove from the list. this I do some times when it got freeze

hderanga
  • 1,269
  • 12
  • 12
1

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"

John Doe
  • 67
  • 10
1

I also face the same problem with netbean 8.2. I just deleted the project by - Right click on the project - Delete the project ( keep unselect delete source code option ). - Again create new project

and its working perfectly now.

Hope its work.

Iftikhar Khan
  • 313
  • 1
  • 5
  • 9
1

I had almost the same problem with Netbeans IDE 8.2, Windows 10 x64, but in my case It didn't even start my IDE.

  1. What I did was just go to my Netbeans project folder and cut everything there, then paste into another folder.
  2. After that, I opened again Netbeans, disabled the auto-scan feature (Menu -> Tools -> Options -> Miscellaneus -> Files -> Uncheck Enabel auto-scanning).
  3. Then, I went to the folder where I pasted my proyects before and put back on my original Netbeans project folder.

Finally, open your Netbeans IDE and VOILA!.

It worked again :)

juanma_
  • 11
  • 5
0

Try this Netbeans plugin. This reduces the load for some extend.

http://wiki.netbeans.org/ScanOnDemand

  • I tried this, but it prevents by IDE from loading at all. Hangs indefinitely at the "Loading modules..." step of the start process. – Joshua Burns Mar 18 '14 at 21:31
  • 2
    Warning: Currently, this plugin only works with development builds. DO NOT use these instructions with an official release!!! – John Slegers Feb 27 '15 at 14:27
  • 1
    Note - using this ScanOnDemand will most probably WRECK your installation .. forcing a reinstall .... – MarcoZen Apr 28 '15 at 03:16
0

Not exactly the case of question, but sometimes "scanning projects" can be stopped just by restarting Netbeans.

Yuriy N.
  • 4,936
  • 2
  • 38
  • 31
0

In my case, with jdk 1.8, there is a big issue when there are multiple static imports (see the example). It seems that there is a problem with javac. The compiler is very slow when checking such a .java file and NetBeans scanning is very very slow. It seems that the compilation and scanning time is increasing very fast with each repeated static import. So, if that is your case, just remove repeated imports

package ru.cntp.demo;

import java.math.BigDecimal;

import static java.util.Arrays.asList;
import java.util.List;
import java.util.Map;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.groupingBy;

/**
 *
 * @author sergiu
 */
public class EmployeeRepository {

    public Map<Department, Map<String, Map<String, Map<String, Map<BigDecimal, List<Employee>>>>>> getEmployeesByDepartment() {

        Country germany = new Country("Germany");

        Department germanyDeptOne = new Department("Dept One", germany);

        Employee emp1 = new Employee("Surame", "Name", "Patronymic", BigDecimal.TEN, germanyDeptOne);


        return asList(emp1).stream()
                .collect(groupingBy(Employee::getDepartment,
                        groupingBy(Employee::getSurname,
                                groupingBy(Employee::getName,
                                        groupingBy(Employee::getPatronymic,
                                                groupingBy(Employee::getSalary))))));
    }

}
Sergiu Starciuc
  • 532
  • 5
  • 9
0

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.

Amol B.
  • 164
  • 4
0

Plugin download - Direct Download

http://wiki.netbeans.org/wiki/images/c/cc/Org-netbeans-modules-scanondemand.nbm

PodTech.io
  • 4,874
  • 41
  • 24
0

I have the quickest and easiest way.

Just put the netbeans metadata to another location instead of putting it on the project directory

Ankit Vishwakarma
  • 1,573
  • 16
  • 13
0

If your project is a Maven structured project you can use a simple trick to make your and NetBeans life a lot easier.

I have my projects inside of c:\dev on my machine. That's the place where Netbeans is working with. If I build in this folder then NetBean's background process get very busy.

But if I copy the c:\dev\trunk project for example to c:\deploy\trunk before I start mvn clean install inside of c:\build\trunk then NetBeans does not need to scan the changes that happen in this folder. It does not know about it.

I use on a windows machine:

robocopy c:\dev\trunk c:\deploy\trunk /MIR /NFL /NS /NC /NDL /XD ".svn"

It is a windows native command. No additional installation necessary.

It helped me a lot decrease build time and also to avoid never ending scans on Netbeans.

If you use tools like JRebel you can still work like this when you update the changed classes to your c:\deploy\trunk folder. You can use the same command.

It is of course a bit of a workaround, but it helps a lot. :-)

Hasan Tuncay
  • 1,090
  • 2
  • 11
  • 30
0

My project became Very Big over time

In the below 2 cases, it is too slow:

  1. While opening NetBeans project - this is too slow
  2. Automatic scanning of NetBeans project

What did not work for me are:
1. Doing Window > Reset Windows only solves temporarily
2. Sometimes felt my GIT repository integration with Netbeans is the main issue, but there was no clear proof for it

Solution for 1):

Run below commands:

WARNING Below commands have automated delete commands

Close the Netbeans IDE
cd %USERPROFILE%\AppData\Local\NetBeans\Cache\                  && del /s /q .\  && rmdir /s /q .\
cd %USERPROFILE%\AppData\Roaming\NetBeans\8.2\var\filehistory\  && del /s /q .\  && rmdir /s /q .\
cd %USERPROFILE%\AppData\Roaming\NetBeans\8.2\var\log           && del /s /q .\  && rmdir /s /q .\

And, the problem 1) is now rarely comes up, other times Netbeans loads almost immediately.

Solution for 2):

root
....f1
........f11
........f12
....f2
........f21
........f22

root is a folder and also it's the main NetBeans project
f1, f2 are just folders
f11, f12, f21, f22 are sub-folders that are also NetBeans projects too

Earlier, I was opening root Netbeans project, and the system became too slow due to netbeans scanning the whole project from root, and antivirus was working very hard to cooperate with Netbeans project scanning, result everything in system gets slow.

Now, the solution is open sub-projects like f11, f12, f21, f22, etc. you can open many small sub-project, the Netbeans project scanning issue is fully gone.

Manohar Reddy Poreddy
  • 25,399
  • 9
  • 157
  • 140
0

My Netbeans 8.0.2 would crash on my Macbook pro due to "Scanning projects..." hogging up my CPU. I couldn't stop the process, however, I could make the process finish quicker by increasing the Java heap memory in netbeans.conf.

$ vi /Applications/NetBeans/NetBeans\ 8.0.2.app/Contents/Resources/NetBeans/etc/netbeans.conf

Replace this:

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"

with:

netbeans_default_options="-J-client -J-Xss2m -J-Xms2048m -J-Xmx2048m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"
Hau Le
  • 191
  • 1
  • 4