Results 1 to 4 of 4

Thread: Where is test.txt file located

  1. #1
    Join Date
    Nov 2009
    Posts
    583

    Where is test.txt file located

    Hi
    I am intermediate developer of java programming language. I have created some programs in java. I have a problem in my code, I have created a FileWriter called outstr and so I specified its destination as
    Code:
    outstr = new FileWriter("test.txt");
    I was able to run the program without any bugs, but now I have no clue as to where the file test.txt was actually written. I'm currently using Windows Vista, and I'm using Eclipse 3.5 Galileo.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Where is test.txt file located

    Hi
    If you do not know the location of the file test.txt. Then use the following code and see where the file is located.
    Code:
    System.out.println("user.dir");
    This will give you the directory where the file is located. By this way you can check the directory. Post back again whether you have solved this or not. If any problems do post back. So, we could help you.

  3. #3
    Join Date
    Nov 2009
    Posts
    583

    Re: Where is test.txt file located

    Hi,
    Thanks for the reply. i tried using the line without quotes, but unfortunately it does not understand what the suer was. Did you mean to replace user with my own username. I did not understand this thing. I figured out a different solution. I ended up just going to File -> Open File, then I just inserted into the search box to find it on my computer. I'm still puzzled as to why it wasn't in a more obvious place. Thanks again for replying.

  4. #4
    Join Date
    May 2008
    Posts
    2,012

    Re: Where is test.txt file located

    Hi
    If you want to view the directory where the file is located then use the code below. "user.dir" is a property which is retrieved via System.getProperty. The above posted code did not called the method, it was just a typo.
    Run this line (exactly as is) - that's where the file will be saved.
    Code:
    System.out.println(System.getProperty("user.dir"));
    This should exactly solve the problem, if not post back again. But by far my experience this will definitely solve your problem.

Similar Threads

  1. Where is the product key file located in Windows 8?
    By --MasseySian-- in forum Operating Systems
    Replies: 1
    Last Post: 05-09-2012, 06:58 PM
  2. Where is msconfig file located?
    By PKTun in forum Operating Systems
    Replies: 5
    Last Post: 29-12-2011, 03:24 PM
  3. Where is save file located for New Star Soccer 5
    By sushantbankar in forum Video Games
    Replies: 4
    Last Post: 16-08-2011, 10:50 AM
  4. Where is located hidden file/folder for x3watch
    By artom3 in forum Windows Software
    Replies: 2
    Last Post: 13-07-2009, 02:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,118,190.34465 seconds with 16 queries