开发者

Monitor file in Java on Linux 64bits

开发者 https://www.devze.com 2023-01-02 06:39 出处:网络
I\'d like to be notified when a file has been created, deleted or changed, but not using polling mechanism.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号