Results 1 to 5 of 5
  1. #1
    Dekkon0 is offline Member
    Join Date
    May 2010
    Posts
    4
    Rep Power
    0

    Default Specify full location of txt file

    Java | import java.io.FileReader; im - FileNotFoundJava - xuMY52B6 - Pastebin.com

    I have my txt file in the same directory as the src file and it fails to find the txt file.

    How do you specify the file manually?

    thanks.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,528
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Dekkon0 View Post
    Java | import java.io.FileReader; im - FileNotFoundJava - xuMY52B6 - Pastebin.com

    I have my txt file in the same directory as the src file and it fails to find the txt file.

    How do you specify the file manually?

    thanks.
    Specify the 'absolute path'; as in your own comment: "Z:\\Workspace\\Java\\JavaLearning\\src\\xanadu.tx t"

    kind regards,

    Jos

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,423
    Rep Power
    25

    Default

    Do you get an error message? If so please post it.
    How do you know it doesn't find the file?

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

    Default

    Quote Originally Posted by Dekkon0 View Post
    How do you specify the file manually?
    How did you do that in your application, can you show it here us to see?

  5. #5
    Dekkon0 is offline Member
    Join Date
    May 2010
    Posts
    4
    Rep Power
    0

    Default

    It gave a FileNotFoundException, which I later wrote a try catch statement. JosAh answered my question, just need to know you had to back slash twice.

Similar Threads

  1. Getting to original File location
    By ravjot28 in forum New To Java
    Replies: 2
    Last Post: 02-28-2010, 04:00 PM
  2. need to copy file from one location to another location
    By naveen.dpt2007 in forum New To Java
    Replies: 4
    Last Post: 02-28-2010, 03:53 PM
  3. how to specify location of file to be uploaded?
    By anthrax in forum New To Java
    Replies: 11
    Last Post: 01-13-2010, 02:48 PM
  4. File Location
    By bcbird in forum New To Java
    Replies: 1
    Last Post: 09-17-2009, 08:03 AM
  5. how to get the full file name
    By priyanka3006 in forum JDBC
    Replies: 0
    Last Post: 08-05-2009, 12:55 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
  •