f



Can I get "My Document", "Desktop" and "Favourite" folder dynamically?

In difference language of Windows, they have difference name, can I get
them dynamically from java? Any API can do this?

0
carfield (39)
4/17/2005 5:50:18 PM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

5 Replies
644 Views

Similar Articles

[PageSpeed] 7

carfield@gmail.com wrote:
> In difference language of Windows, they have difference name, can I get
> them dynamically from java? Any API can do this?
> 
I just now it from "My Documents". This is the System Property "user.home".
Because i am using Linux with the "windowmaker" Desktop, I have no Idea, 
  what the other two ("Desktop", and "Favourite") could mean. Probably 
theese two are MsWindows specific ??
0
phi (5)
4/17/2005 5:07:16 PM
Philipp Gressly wrote:

>> In difference language of Windows, they have difference name, can I get
>> them dynamically from java? Any API can do this?
>>
> I just now it from "My Documents". This is the System Property "user.home".

The actual locations of those folders would be stored in the system registry, 
which can be read with native Windows functions. You'd need to use JNI, or look 
on Google for a package that is already written that uses JNI to do it. I 
haven't had the occasion to look for such a package, but I know they're out 
there. :) Here's a Google query that should work:

java "windows registry"

(make sure you enclose "windows registry" in double quotes)

Also, after clicking around a bit, I found:

http://www.lattelib.com/

The Windows library provides a Java class that can query and set registry 
settings and environment variables. (I'd use JNI to query/set environment 
variables, myself, but... this library might be useful for the registry 
features. Haven't tried it myself yet.)

-- 
JustThe.net - Apple Valley, CA - http://JustThe.net/ - 888.480.4NET (4638)
Steven J. Sobol, Geek In Charge / sjsobol@JustThe.net / PGP: 0xE3AE35ED

"The wisdom of a fool won't set you free"
     --New Order, "Bizarre Love Triangle"
0
sjsobol (523)
4/17/2005 6:28:59 PM
Steve Sobol wrote:

> The Windows library provides a Java class that can query and set 
> registry settings and environment variables. (I'd use JNI to query/set 
> environment variables, myself, but... this library might be useful for 
> the registry features. Haven't tried it myself yet.)

Hm. Now that I think about it, has anyone created a JNDI interface to the 
Windows Registry? :)

-- 
JustThe.net - Apple Valley, CA - http://JustThe.net/ - 888.480.4NET (4638)
Steven J. Sobol, Geek In Charge / sjsobol@JustThe.net / PGP: 0xE3AE35ED

"The wisdom of a fool won't set you free"
     --New Order, "Bizarre Love Triangle"
0
sjsobol (523)
4/17/2005 6:33:59 PM
Steve Sobol wrote:

> The Windows library provides a Java class that can query and set 
> registry settings and environment variables. (I'd use JNI to query/set 

gah. JNDI, not JNI.

-- 
JustThe.net - Apple Valley, CA - http://JustThe.net/ - 888.480.4NET (4638)
Steven J. Sobol, Geek In Charge / sjsobol@JustThe.net / PGP: 0xE3AE35ED

"The wisdom of a fool won't set you free"
     --New Order, "Bizarre Love Triangle"
0
sjsobol (523)
4/17/2005 6:35:03 PM
Philipp Gressly wrote:

> carfield@gmail.com wrote:
> 
>> In difference language of Windows, they have difference name, can I get
>> them dynamically from java? Any API can do this?
>>
> I just now it from "My Documents". This is the System Property "user.home".
> Because i am using Linux with the "windowmaker" Desktop, I have no Idea, 
>  what the other two ("Desktop", and "Favourite") could mean. Probably 
> theese two are MsWindows specific ??

user.home is not My Documents, at least on my computer it isn't.  I 
would be really curious to know if it really is on yours.

public class test {
     public static void main(String[] args) {
         System.out.println(System.getProperty("user.home"));
     }
}

Output is:
C:\Documents and Settings\Knute Johnson
on my XPsp2 computer.

-- 

Knute Johnson
email s/nospam/knute/
0
nospam6429 (211)
4/17/2005 9:29:19 PM
Reply: