config file in user home

Discussion in 'Java' started by Gaz, Apr 8, 2005.

  1. Gaz

    Gaz Guest

    i'm using user.home to get the home directory of the user and store a
    config file there however in college the user home dir returns
    c:\username\home however users don't have write permissons to that dir
    so I need to be able to save it in H:\user\home but I need to be able to
    save it in the users home dir on all other machines anyone got any ideas
    or a work around?
     
    Gaz, Apr 8, 2005
    #1
    1. Advertising

  2. Gaz

    kaeli Guest

    In article <A9z5e.51174$>, enlightened us
    with...
    > i'm using user.home to get the home directory of the user and store a
    > config file there however in college the user home dir returns
    > c:\username\home however users don't have write permissons to that dir
    > so I need to be able to save it in H:\user\home but I need to be able to
    > save it in the users home dir on all other machines anyone got any ideas
    > or a work around?


    Check permissions before attempting to write.
    http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#canWrite()

    --
    --
    ~kaeli~
    If the funeral procession is at night, do folks drive with
    their lights off?
    http://www.ipwebdesign.net/wildAtHeart
    http://www.ipwebdesign.net/kaelisSpace
     
    kaeli, Apr 8, 2005
    #2
    1. Advertising

  3. Gaz

    Jacob Guest

    Gaz wrote:

    > i'm using user.home to get the home directory of the user and store a
    > config file there however in college the user home dir returns
    > c:\username\home however users don't have write permissons to that dir
    > so I need to be able to save it in H:\user\home but I need to be able to
    > save it in the users home dir on all other machines anyone got any ideas
    > or a work around?


    Use the JDK Preferences package for this purpose.
    On MS-based systems the configuration will go in
    the "Windows Registry", on Unix it will be stored
    somewhere underneeth the user home dir. Point is
    that you don't need to know; JDK ensures a valid
    location.


    --
    Jacob Dreyer
    G - Free 2D Graphics Library for Java - http://geosoft.no/graphics
    Free Java Software - http://geosoft.no/software
     
    Jacob, Apr 11, 2005
    #3
    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. CSharpner
    Replies:
    0
    Views:
    1,092
    CSharpner
    Apr 9, 2007
  2. nancyflorida
    Replies:
    0
    Views:
    351
    nancyflorida
    Nov 12, 2007
  3. nancyflorida
    Replies:
    0
    Views:
    330
    nancyflorida
    Nov 12, 2007
  4. * Its my Pleasure *
    Replies:
    0
    Views:
    391
    * Its my Pleasure *
    Feb 20, 2008
  5. kampy
    Replies:
    9
    Views:
    349
    Steven D'Aprano
    Oct 19, 2012
Loading...

Share This Page