Below is diagram that shows what I\'m trying to do : it is just 2 programs. One is a simple Child
program that writes out integers every 2 seconds, line-by-line
You can use the directory watch service:
https://docs.oracle.com/javase/tutorial/essential/io/notification.html
You can configure a path or a file and register a watcher
.
The watcher gets a notification every time a file is changed. You can store this timestamp of a notification for later use.
For details see my link above.
You may then use a Timer or a Thread to check last modification.