Monitor text file for changes in Java -


i trying monitor text file change in 1 line of text contains. file being deleted , created same name , path content changes.

i trying construct if statement if content of file changes system print console.

i have looked @ this stack overflow question , tried using java-diff-utils example found on page, not find way implement solve problem.

start generating md5 of original file, using background thread, recalculate md5 , compare original. when hash changes, file contents have changed.

check out md5 hashing example

if you're using java 7, use watcher service monitor changes file. replace thread


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -