This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am working on a distributed kind of Project in which i have to call 1 program from another according to requirement.
My problem is that in this whole process i have to check a folder, i.e. i have to keep checking a folder if it's populated with one or more files or not, if yes than call another Jar file
in process, and if not than keep checking it untill it's populated or not. But m unable to do that.. please help me in that issue. Paste some sample code if available.
If you can use an Opensource Utility use Jnotify it will save you the developement and testing time.
You can make classes implementing the call back interface of JNotify. Whenever a file comes you app gets the notification. Couldn't have been neater no pooling required . JNotify supplies Native files (.dll for windows .so for linux) I have tested it extensivally on Windows and Linux it works pretty well .....
If you have any problem which you are not able to solve after help from Web Search lemme know .....
Joined: Feb 24, 2010
Thanks for your precious replies . Well i've solved that problem through a simple method. I have run a infinite loop and am checking the folder if it has some file or not at every 10 minutes. I've used Thread.sleep() for waiting. It was a simple glitch,well i will test it through your methods too , but let me complete this project first . Thanks once again .Cheers
My requirement is the same only, what i have to do means I keep on watching the folder in a C: \sourcefolder drive if the folder is updated with new file then I have to transfer the files to server machine .meanwhile at the same I have to find whether the file is fully written , why because some of the process will be writting the files in that folder I have check whether the file is fully written then i have to tarnsfer .i should not transfer the file if its partially written .
I am working on stand alone networking(JAVA) project , I need to transfer files from client to server when ever any new files added to the client folder.