Results 1 to 14 of 14
  1. #1
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    149
    Rep Power
    0

    Default [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.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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?

  3. #3
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    149
    Rep Power
    0

    Default

    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

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  6. #6
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    149
    Rep Power
    0

    Default

    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....:confused:

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Yes, but I'm worried how you code works. Did you notice the error on this line.

    Java Code:
    if (currentFiles.getName().equals(existingFiles2[j].getName())) {
    Actually you have done the same mistake in another line of the above code.

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

  9. #9
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    149
    Rep Power
    0

    Default

    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....
    Attached Files Attached Files

  10. #10
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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?

  11. #11
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    149
    Rep Power
    0

    Default

    Let me try that

  12. #12
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    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.

  13. #13
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    149
    Rep Power
    0

    Default

    ITs Done....Thanks for time and support

  14. #14
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. [SOLVED] Folder Watching
    By jazz2k8 in forum New To Java
    Replies: 8
    Last Post: 07-04-2008, 02:49 PM
  2. folder cloning
    By jad in forum Advanced Java
    Replies: 1
    Last Post: 07-01-2008, 01:28 AM
  3. add password to folder
    By ismailsaleh in forum AWT / Swing
    Replies: 1
    Last Post: 01-08-2008, 06:46 AM
  4. how to use class in upper folder
    By osval in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 09:55 PM
  5. creation of new folder in the mail
    By an8086 in forum Advanced Java
    Replies: 1
    Last Post: 07-15-2007, 06:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •