tags:

views:

665

answers:

2
  1. Specifically getting on Windows the "..\Documents & Settings\All Users, basicaly any path that needs the front end to be dynamically derived based on the OS your software is running on. (Now I need the answer to this)
  2. the current users My Documents dirctory (okay this has been answered) and basicaly any path that needs the front end to be dynamically derived based on the OS your software is running on.
+6  A: 

My docs would probably best be handled by accessing:

System.getProperty("user.home");

Look up the docs on System.getProperty.

nt
+2  A: 

Any information you can get about the user's environment can be fetched from

System.getProperty("...");

For a list of what you can get, take a look here: http://mgrand.home.mindspring.com/java-system-properties.htm

I don't think you'll be able to get the path you require (the All Users path) in an OS dependent way. After all - do other operating systems have an equivalent? Your best bet is to probably inspect:

System.getProperty("os.name");

to see if you are running Windows and then if so use "C:\Documents & Settings\All Users\".

But you'll be better off just constantly using

System.getProperty("user.home");

(as mentioned by other people) throughout the application. Or alternatively, allow the user to specify the directory to store whatever it is you want to store.

Lee Theobald