Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3933690
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:37:47+00:00 2026-05-19T23:37:47+00:00

I have an application in which I want to listen to any changes made

  • 0

I have an application in which I want to listen to any changes made to a particular directory. The application should ping me as soon as there are any files added, deleted or updated in that directory.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T23:37:48+00:00Added an answer on May 19, 2026 at 11:37 pm

    You can use JNotify

    JNotify is a java library that allow java application to listen to file
    system events, such as: File created
    File modified File renamed File
    deleted Supported platforms

    Windows (2000 or newer) Windows notes
    Linux with INofity support (2.6.14 or
    newer) Linux notes Mac OS X (10.5 or
    newer) Mac OS notes

    More Info :

    Download JNotify from here

    Extract the zip, put .dll/.so according to platform in your lib path. and create a class provide jnotify-0.93.jar in class path.

    Sample code:

    package org.life.java.stackoverflow.questions;
    
    import net.contentobjects.jnotify.JNotify;
    import net.contentobjects.jnotify.JNotifyListener;
    
    /**
     *
     * @author Jigar
     */
    public class JNotifyDemo {
    
        public void sample() throws Exception {
            // path to watch
            String path = System.getProperty("user.home");
    
            // watch mask, specify events you care about,
            // or JNotify.FILE_ANY for all events.
            int mask = JNotify.FILE_CREATED
                    | JNotify.FILE_DELETED
                    | JNotify.FILE_MODIFIED
                    | JNotify.FILE_RENAMED;
    
            // watch subtree?
            boolean watchSubtree = true;
    
            // add actual watch
            int watchID = JNotify.addWatch(path, mask, watchSubtree, new Listener());
    
            // sleep a little, the application will exit if you
            // don't (watching is asynchronous), depending on your
            // application, this may not be required
            Thread.sleep(1000000);
    
            // to remove watch the watch
            boolean res = JNotify.removeWatch(watchID);
            if (!res) {
                // invalid watch ID specified.
            }
        }
    
        class Listener implements JNotifyListener {
    
            public void fileRenamed(int wd, String rootPath, String oldName,
                    String newName) {
                print("renamed " + rootPath + " : " + oldName + " -> " + newName);
            }
    
            public void fileModified(int wd, String rootPath, String name) {
                print("modified " + rootPath + " : " + name);
            }
    
            public void fileDeleted(int wd, String rootPath, String name) {
                print("deleted " + rootPath + " : " + name);
            }
    
            public void fileCreated(int wd, String rootPath, String name) {
                print("created " + rootPath + " : " + name);
            }
    
            void print(String msg) {
                System.err.println(msg);
            }
        }
        public static void main(String[] args) throws Exception {
            new JNotifyDemo().sample();
        }
    }
    

    Output:

    modified C:\Documents and Settings\jigar: LOCALS~1\Temp\etilqs_4s8ywsvyukghK0uDxRop
    modified C:\Documents and Settings\jigar : LOCALS~1\Temp\etilqs_4s8ywsvyukghK0uDxRop
    modified C:\Documents and Settings\jigar : LOCALS~1\Temp\output1295531079119
    modified C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default
    deleted C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\f_001ea9
    created C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\f_001eae
    modified C:\Documents and Settings\jigar : LOCALS~1\Temp\etilqs_04gchL79ZJrpClZIqiom
    modified C:\Documents and Settings\jigar : LOCALS~1\Temp\etilqs_04gchL79ZJrpClZIqiom
    modified C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache
    modified C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\f_001eae
    modified C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\f_001eae
    modified C:\Documents and Settings\jigar : LOCALS~1\Temp\output1295531079119
    modified C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Current Session
    deleted C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\f_001ea8
    created C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\f_001eaf
    modified C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache
    modified C:\Documents and Settings\jigar : LOCALS~1\Temp\etilqs_04gchL79ZJrpClZIqiom
    modified C:\Documents and Settings\jigar : LOCALS~1\Temp\etilqs_04gchL79ZJrpClZIqiom
    modified C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\f_001eaf
    modified C:\Documents and Settings\jigar : Local Settings\Application Data\Google\Chrome\User Data\Default\Cache\f_001eaf
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I want to implement methods which record the sound if any
I want to make window-base application in c++, I have listen about wxwidgets. Can
I have a Winsock based server application which uses Windows Winsock I/O Completion Ports.
I want to have a twisted service (started via twistd) which listens to TCP/POST
Suppose that I have an android application which always runs at background. What the
I have an application which includes a login session. When the application is suspended
I have an application in which the user interacts with a database and prepares
I have built an Android chat application. It has a TCP server which is
I have a java application (jar file) and I want to add some sort
I want to create an application which will be notified by server for new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.