Results 1 to 3 of 3
  1. #1
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Posts
    364
    Rep Power
    5

    Default Buffered Reader File Location

    If I have a buffered reader, is there anything that I can do to be able to just pass in the name of the file, as opposed to the whole path...IE C:/Users/Desktop/foo.txt?

    BufferedReader in
    = new BufferedReader(new FileReader("foo.txt"));

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default

    Have you tried it? It will work as long as the file is in your working directory.

  3. #3
    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

    In simple words, do you know about the absolute path and relative path.

    You can keep the file in two places mainly, within the working folder and outside of it.

Similar Threads

  1. Buffered reader
    By franckboy in forum New To Java
    Replies: 1
    Last Post: 02-02-2011, 08:16 PM
  2. Buffered Reader
    By ilovepolluting in forum New To Java
    Replies: 2
    Last Post: 02-04-2010, 10:16 AM
  3. Buffered Reader problem
    By pradeep.theonlyone in forum New To Java
    Replies: 3
    Last Post: 07-31-2009, 12:37 PM
  4. Buffered Reader Exception
    By hitmen in forum New To Java
    Replies: 6
    Last Post: 01-07-2009, 12:14 PM
  5. FileReader / Buffered Reader
    By sepaht in forum New To Java
    Replies: 9
    Last Post: 07-10-2008, 09:05 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
  •