How to get users home directory?

Discussion in 'Java' started by Bryan, Jul 13, 2007.

  1. Bryan

    Bryan Guest

    Hi,

    How in java do I find the users home directory? I have an app that
    needs to write some files to the current users Documents and Settings
    directory on XP.

    Thanks,
    Bryan
    Bryan, Jul 13, 2007
    #1
    1. Advertising

  2. Bryan

    Carl Guest

    Bryan <> writes:

    > Hi,
    >
    > How in java do I find the users home directory? I have an app that
    > needs to write some files to the current users Documents and Settings
    > directory on XP.
    >
    > Thanks,
    > Bryan


    Try:

    String userHome = System.getProperty("user.home");

    hope that helps,
    Carl.
    Carl, Jul 13, 2007
    #2
    1. Advertising

  3. Bryan

    Oliver Wong Guest

    "Bryan" <> wrote in message
    news:FhPli.6391$...
    > Hi,
    >
    > How in java do I find the users home directory? I have an app that
    > needs to write some files to the current users Documents and Settings
    > directory on XP.


    Use system properties. A list of available properties are at:
    http://www.mindspring.com/~mgrand/java-system-properties.htm

    - Oliver
    Oliver Wong, Jul 13, 2007
    #3
  4. Bryan

    Roedy Green Guest

    On Fri, 13 Jul 2007 11:13:58 -0700, Bryan <> wrote,
    quoted or indirectly quoted someone who said :

    >How in java do I find the users home directory? I have an app that
    >needs to write some files to the current users Documents and Settings
    >directory on XP.


    see http://mindprod.com/jgloss/properties.html
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Jul 13, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. john
    Replies:
    4
    Views:
    672
    Jim Higson
    Jun 15, 2006
  2. nancyflorida
    Replies:
    0
    Views:
    329
    nancyflorida
    Nov 12, 2007
  3. nancyflorida
    Replies:
    0
    Views:
    316
    nancyflorida
    Nov 12, 2007
  4. Ann
    Replies:
    0
    Views:
    204
  5. scmiles

    mapping to users home directory

    scmiles, Oct 14, 2003, in forum: ASP General
    Replies:
    15
    Views:
    224
    Aaron Bertrand [MVP]
    Oct 21, 2003
Loading...

Share This Page