Listen for changes to a text file
Hi all,
firstly I hope this is the right place for this post. 2ndly I hope I don't already have the answer, but here goes.
My program reads in a text file. At the moment I assume that it is static, but now I want to be able to listen for changes to that file (e.g. more lines added) and when they are do stuff.
I think I could do it by having a separate thread checking the number of lines in the file and reading any new ones, but really I'd like to have a change listener which raises an event when a line is added.
In this thread from 2003 it seems to be suggested that I have to have a separate thread checking the file for me, but I was wondering if anyone had any better solutions?
http://forum.java.sun.com/thread.jspa?forumID=256&threadID=443852

