
07-23-2008, 09:19 AM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Posts: 144
Rep Power: 0
|
|
[SOLVED] Folder watch Issue
Here is my requirement:
I have a folder in which files will be placed for a particular interval of time.But I am facing a problem after picking two files.Code is running continuosly but from third file it is not picking.
If you have any simple method can you please let me know....:-)
Thanks
Last edited by jazz2k8; 07-23-2008 at 02:24 PM.
|
|

07-23-2008, 09:41 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,446
Rep Power: 11
|
|
|
Is that your third file is exist when you picking. Basically did you close all streams and all in correct way before picking it. Did you picking files in a specific interval?
|
|

07-23-2008, 09:54 AM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Posts: 144
Rep Power: 0
|
|
|
yes the third file exists.
As soon as the file comes into the folder,jva program should pick that file and disply the file name.This is working fine for first two files.Then after it is not displaying the file name.
Thanks
|
|

07-23-2008, 10:03 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,446
Rep Power: 11
|
|
|
You get any exception there?
|
|

07-23-2008, 10:09 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,446
Rep Power: 11
|
|
|
What'a you getName() method do for file array? It's not a valid method I think.
|
|

07-23-2008, 12:23 PM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Posts: 144
Rep Power: 0
|
|
getName() is for only to get the name of the file..The programming is running with out any exceptions...but the third file onwards it is not picking any....
|
|

07-23-2008, 12:36 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,446
Rep Power: 11
|
|
Yes, but I'm worried how you code works. Did you notice the error on this line.
|
Code:
|
if (currentFiles.getName().equals(existingFiles2[j].getName())) { |
Actually you have done the same mistake in another line of the above code.
|
|

07-23-2008, 12:40 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,446
Rep Power: 11
|
|
|
How did you create new files to picking up. Can you show the code, I can't test it, and lazy to handle it by hand now.
|
|

07-23-2008, 01:10 PM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Posts: 144
Rep Power: 0
|
|
|
here i am ataching the screen shots ..
when asset.txt loaded into the folder it is taking as No of NewFiles as 1 and it picked up that file name.Even for second too contract.txt....from there it is not picking the third file name....
|
|

07-23-2008, 01:14 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,446
Rep Power: 11
|
|
|
I hope the issue with your application is about threads. Or your list may be empty when you search. Since you use NetBeans easy to debug and see. Have you tried it?
|
|

07-23-2008, 01:18 PM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Posts: 144
Rep Power: 0
|
|
|
Let me try that
|
|

07-23-2008, 01:22 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,446
Rep Power: 11
|
|
|
Yes, you should do it at first time you comes with this case jazz. It's the simple way to find the error. Have a try and see. Specially check the list content, each file is exist before pick.
|
|

07-23-2008, 02:23 PM
|
 |
Senior Member
|
|
Join Date: Apr 2008
Posts: 144
Rep Power: 0
|
|
|
ITs Done....Thanks for time and support
|
|

07-24-2008, 06:46 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,446
Rep Power: 11
|
|
|
Nice, did you find it on debug? I hope so, and that's the best way to do such thing in nicer way.
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 09:26 PM.
|
|