I'd like to be notified when a file has been created, deleted or changed, but not using polling mechanism.
I have surveyed related Java API that can use.(EX:JNotify, JPathWatch and JXFileWatcher)
Those APIs pro开发者_如何学Govide file monitor by using native component on OS. But I met the same problem is that they can't run on Linux 64bits, because native component in those APIs donen't support Linux 64bits, and this confused me for a long time.
I also know that there'll be a WatchService API as part of NIO2 in JDK7, but JDK7 has not released yet.
So, can any one suggest me a better solution? Very Thanks.
have you tried inotify-java ?
Also, as far as I can see, native component of JNotify comes in C-sources, so you can compile it yourself for any platform.
精彩评论