is it possible to monitor folder using java code?


is there anyone know how to monitor a folder using java? or anyone could gave me a point that how could i start this. here's my thought about it.

start a thread to scan the folder changes,which could be create,delete,update files in this folder or something else happen,like last updated.
but in this case, you have to control thread loop. if this thread loop is not controlled well,then it would be a waste of cpu and may cause a fatal problem.

or,is there any framework or some demo code to do this ? hope we could find a better way to do this. thank u very much.

6
задан Barry Wei 28 September 2010 в 08:03
поделиться