An Oracle blog about NetBeans for PHP

Enable auto-scanning of sources - Scan for External Changes

NetBeans 6.9 contains a feature that automatically looks for external changes to keep informations about files up-to-date. We have some reports that it can slow down NetBeans mainly, when an open project has many folders. When NetBeans find out that files were externally changed, it re-scans the files to keep data up-to-date that are used with features like code completion, navigation etc. Unfortunately the notification and following re-scanning can take some time and during this time many mentioned features are waiting for the finishing of scanning. There is option Enable auto-scanning of sources that can switch off this behavior. The option you can find it in Options dialog, Miscellaneous category and Files tab.

The default behavior is that NetBeans also looks for external changes when the main window gets focus. This is can be during developing a web application very often when user switches between browser and IDE. The mentioned option also switch this off.

When you switch off  option Enable auto-scanning of sources you can still keep the information up-to-date, just invoke Scan for External Changes  action from Sources menu manually.

Join the discussion

Comments ( 24 )
  • Tom Wednesday, June 2, 2010

    So, this finally might render the (in-?)famous "Scan on Demand" plug-in for NetBeans obsolete. IMHO it's a good thing!

  • Kristian Wiborg Wednesday, June 2, 2010

    That sounds really great! When will it become available? I'm using a DEV build, but I don't see the new feature (maybe I'm using an older DEV version?). I think this could be great for me because our DEV-server at work is a bit slow at times and this is where we keep the files. I thought it was a networking issue for a long time but it turns out that it is the server. Anyway the server seems to have huge impact on how responsive NetBeans is. Even basic text-editing such as copying code, deleting lines code etc. frequently has lag. This is ok for a while, but after a few hours of coding it gets really annoying, and I start focusing on the editor instead of banging out code :-) I also use NetBeans at home where I have the files I'm editing on my local drive. This is working 100xTimes better. I hope (and think) this new feature will improve my daily NetBeans experience and I can't wait to try it. There is no way I'm switching to another editor because NetBeans is still the best. Thanks a lot to the developer(s) who are implementing this feature!

  • pit Wednesday, June 2, 2010

    this is a great tip!

    that scan external was eating my memory all the time! thanx for the share :D

    Kristian just download and use the 6.9 RC1 or builds that come after it if there are ;)

  • Joris van de Sande Wednesday, June 2, 2010

    I have installed the ScanOnDemand plugin last week. But I'm going to disable it now and try this great new feature of netbeans!

  • Petr Pisl Thursday, June 3, 2010

    @Kristian: If I understand, you have the sources on a network drive, is it right? I'm afraid that the option will not solved all your problems. It will help, but on the local drive it will always faster. I hope that at least the userdir you have on the local drive.

  • Kristian Wiborg Friday, June 4, 2010

    @Petr Pisl: Yes I have the sources on a networked drive and you are right the new feature hasn't solved all issues. But is has helped. We will be upgrading our server at work in the near future and hopefully that will also contribute to a less frustrating NetBeans-experience. BTW I do have the user-dir on my local harddrive.

  • guest Monday, June 7, 2010

    @Kristian: Try to convince your company and yourself to use a VCS system like Subversion. It's very useful and your work will be easier.

  • Ole Hejlskov Wednesday, June 9, 2010

    Nice! Is there any way to assign a key to "Scan for external changes" ? :)

  • Petr Pisl Wednesday, June 9, 2010

    @Ole Hejlkov: Sure, you can assign a shortcut to an action in Tools->Options->Keymaps. Find the action and assign a shortcut.

  • Ole Hejlskov Wednesday, June 9, 2010

    @Petr Pisl

    Awesome! :D

  • ptuna Thursday, June 17, 2010

    Not really sure I like this feature at all. I disabled it because Netbeans 6.9 began using a lot more memory, and the "Checking for external changes" scan was taking a long time and running too often. I actually prefer Netbeans 6.8 and have gone back to it. In 6.8 when I create a new file in Windows explorer, the Netbeans project tree gets automatically refreshed to show the new file. In 6.9 with "Enable auto-scanning" disabled, the project tree doesn't get auto-refreshed to show the new file. So I like the way 6.8 worked better. It scanned in the background for changes but didn't use up much memory. Am I wrong?

  • Travis Monday, June 21, 2010

    I really don't like this feature, we have a large codebase and it caused NB to freeze a lot and lag due to a large number of files it had to keep checking on. If I had a smaller project base it would probably be an excellent feature but not for me.

  • Aleksey Thursday, June 24, 2010

    Totally agreed with ptuna. I like how it worked in NB 6.8. Why NB performs scan on each window focus? I want to disable such feature but save NB6.8 - like scans.

  • Petr Pisl Thursday, June 24, 2010

    @Aleksey: NetBeans 6.8 doesn't know about external changes, if the file is not somehow touch by NB. So when you did change (for example update a VCS from command line) then NB 6.8 doesn't rescan the sources and features like CC work with old data cached in an Lucene index.

    NB 6.9 tries to handle this automatically. It's change in the core and we have to complain against the core (if we want). I hope that all problems will be fixed soon.

  • Andrew Sunday, July 4, 2010

    I like this feature, but it doesn't add anything new. We already had ScanOnDemand plugin which does the same.

    The problem with scanning is not its speed. It is the \*PERCEPTION\* of speed that matters. Why do I have to sometimes wait for it? Why is everything slower when it runs? Why does it freeze from time to time?

    The real solution would be:

    - remember the old scanned data and use it until you get a newer version

    - scan in background (another thread), be nice

    - no process should wait for scanning to finish, they should all use the old data

    - when scanning has finished, just switch the data

    I know this is oversimplification, but please give the developers older machines and HUGE projects (with lots of unnecessary files) and I guarantee you this issue will be solved in a week. ;)

  • Red Thursday, July 15, 2010

    I too just switched back to 6.8, as 6.9 was totally unusable because of the constant scanning. Adding a checkbox which the user must go&click is in no way a solution to this problem.

  • Brian Wednesday, October 13, 2010

    I know what this is \*supposed\* to do, but it's broken in Netbeans 6.9.1. I have ScanOnDemand uninstalled, I have "Enable auto-scanning" disabled, but still Netbeans insists on running the memory-intensive, CPU-intensive, "Scanning Projects" sequence every time I open Netbeans, open a project, and who knows what else.

  • Jeff Whiting Tuesday, October 19, 2010

    Is there a way to change how often it check for external changes. I like having it enabled but would like it to run once every 10 minutes or 30 minutes or something like that. Is there a way to configure that?

    In reference to Brian. If you want auto-complete (and other modern IDE features) you have scan the project at some point in time. So have it scan once when you start netbeans or on project open is pretty much required if you want those features.

  • Nick Dunn Thursday, February 24, 2011

    When I disable the auto scanning, the IDE no longer alerts me to problems (i.e. missing methods that I haven't implemented when I declare that I implement an interface). I also consistently get an IndexOutOfBoundsException http://netbeans.org/bugzilla/show_bug.cgi?id=187924. Ughh.

    With it enabled I need to restart the program about once every 30 minutes or so as it just becomes completely unusable, using 1 gig of memory and 100% cpu.

  • lazer epilasyon Friday, April 1, 2011

    La depilación láser, láser de la información Bienvenido a Daphne. La depilación láser antes de la aplicación yaptırmadan Le recomendamos que lea nuestra información.

  • slikts Thursday, April 14, 2011

    I'd just like to pile in and say the scanning is a source of pain. It's intrusive and constantly reminds about itself either by preventing other functionality (autocomplete, go to declaration etc.) in the UI or not functioning reliably itself. For instance, I just had to restart the IDE because it couldn't see the files the IDE itself had just created. I knew they were there, because I could see them working on the server, but the project tree just didn't update. Now I'll have to endure the scan taking forever due to having to work with large projects on network shares. It would all be solved if NetBeans would just cache the results of previous scans. It would be much more useful than a hacky option to disable automatic scanning.

  • lazer epilasyon Friday, April 15, 2011

    Also I've seen a higher demand of memory if you have Web enabled. Make sure not to have it enabled if you are not using it. If you still have issues use VisualVM when the lockup occurs to get both a thread and Heap dump and file an issue with those.

  • CS Tuesday, December 27, 2011

    not sure about what to do on linux, but in the windows version why not use file hooks? Visual Studio does this very well - the IDE is notified by the OS of any changes and immediately asks the user how they want to resolve the conflict.

  • guest Thursday, October 4, 2012

    So good!


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.