开发者

Java api to get Microsoft Windows Special folders

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.


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.


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

Edit: This no longer works as of Windows Vista and newer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜