Results 1 to 4 of 4
Thread: Getting User name for paths
- 09-08-2010, 06:40 PM #1
Member
- Join Date
- Sep 2010
- Posts
- 31
- Rep Power
- 0
Getting User name for paths
Is there a way to get the name of the user for a path? I want to make a program that can create/open/read files on any computer on which the program is run. As far as I know, paths are as follows (for Windows)
but this won't work without the username in question; so how can I get the name of the user running the program so I can use it in a path? Or is there a generic I can use instead?Java Code:C:\Users\[username]\folder\file
Thank you.
- 09-08-2010, 06:52 PM #2
Member
- Join Date
- Sep 2010
- Posts
- 31
- Rep Power
- 0
I realize that all backslashes in the code sample should be doubled, my bad
- 09-08-2010, 07:00 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,372
- Blog Entries
- 7
- Rep Power
- 17
- 09-09-2010, 09:25 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Similar Threads
-
a little help with file paths
By ashton in forum New To JavaReplies: 3Last Post: 01-27-2009, 04:08 PM -
getting paths and directories
By marco in forum Java AppletsReplies: 3Last Post: 11-25-2007, 07:28 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks