File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Dynamically reading the files at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Dynamically reading the files at runtime" Watch "Dynamically reading the files at runtime" New topic
Author

Dynamically reading the files at runtime

Faraz Ka
Ranch Hand

Joined: Jun 01, 2013
Posts: 53
Hello,

My web Application when gets started reads from a file system for files and does some processing.
Every time the folder gets updated with new files, the web Application needs to be relaunched.

Any clue how to make it dynamic so that when the new file gets added it is picked for processing without a restart?

Thanks,
Faraz
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  72
If you're using Java 7 you can use a built-in API: http://docs.oracle.com/javase/tutorial/essential/io/notification.html. Otherwise you will have to write your own task that scans the directory regularly for changes (maybe using the java.util.Timer and TimerTask classes).
Faraz Ka
Ranch Hand

Joined: Jun 01, 2013
Posts: 53
Hello Ulf,

I'm using Java 7 and hence will try out the API that you mentioned.

Thanks,
Faraz
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically reading the files at runtime