My favorites | Sign in
Project Logo
                
People details
Project owners:
  nbargnesi

This project is currently maintained on Launchpad.

The inotify-java API provides an event-based mechanism for monitoring Linux file system events using the inotify interface provided by glibc (versions 2.4 and up) and the Linux kernel, starting from 2.6.13.

Features

Installation

  1. Extract the archive.
  2. Build it.
  3. Copy libinotify-java.so to a suitable location.
  4. Copy inotify-java-[version].jar to a suitable location.

Example

        try {
            Inotify i = new Inotify();
            InotifyEventListener e = new InotifyEventListener() {

                @Override
                public void filesystemEventOccurred(InotifyEvent e) {
                    System.out.println("inotify event occurred!");
                }

                @Override
                public void queueFull(EventQueueFull e) {
                    System.out.println("inotify event queue: " + e.getSource() +
                            " is full!");
                }
                
            };
            i.addInotifyEventListener(e);
            i.addWatch(System.getProperty("user.home"), Constants.IN_ACCESS);
        } catch (UnsatisfiedLinkError e) {
            System.err.println("unsatisfied link error");
        } catch (UserLimitException e) {
            System.err.println("user limit exception");
        } catch (SystemLimitException e) {
            System.err.println("system limit exception");
        } catch (InsufficientKernelMemoryException e) {
            System.err.println("insufficient kernel memory exception");
        }

Example Summary

  1. Create an instance.
  2. Add an event listener.
  3. Add watches.

Links









Hosted by Google Code