config file in user home

G

Gaz

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?
 
K

kaeli

[email protected] enlightened us said:
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
 
J

Jacob

Gaz said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top