Revision as of 20:31, 23 January 2010 by Tboudreau (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)

I want to listen for changes in a file that may not exist or may be deleted and re-created

There are some cases where you want to listen for changes in a file or folder that does not exist, or may be created and deleted on the fly.

As of NetBeans 6.7, you can use FileUtil.addFileChangeListener(FileChangeListener, File) to listen for such changes.

Note that this is much preferable to


which will notify you of every change in every file on the user's disk that the IDE finds out about, as that will trigger notifications every time the user saves, compiles, or anything - that has much more overhead, since the listener will be called very frequently and most changes will be uninteresting.

Note the caveats about files created outside NetBeans process or using, as described in DevFaqListeningForFileChanges, apply.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo