views:

59

answers:

2

I once found a nifty little library that used JNI to allow java applications on Windows to get the locations of various "special" directories on windows. I can't for the life of me find it again...

In particular, I need to get the location of the "All Users" (shared) "Application Data" directory.

So, anyone have a bullet proof way in Java to locate the "All Users" "Application Data" folder?

It needs to be bullet proof.

+1  A: 

You could use the following property in the environment:
ALLUSERSPROFILE=C:\Documents and Settings\All Users

Romain Hippeau
Does this work on all versions of windows, including XP?
SvrGuy
yup, works on my XP machine
seanizer
A: 

You might want to research Environment Variables:

http://en.wikipedia.org/wiki/Environment_variable#DOS_and_Windows http://en.wikipedia.org/wiki/Environment_variable#System_path_variables

The System.getenv() method offers a list of the system's environment variables and it's included in the core library. Doesn't get much more bullet-proof than that.

Nitrodist