Alex Rivera | Logout

How to get the Desktop path in java

Asked 2009-07-03T19:52:17.187
65

I think this will work only on an English language Windows installation:

System.getProperty("user.home") + "/Desktop";

How can I make this work for non English Windows?

Edit
Report

1 Answer

3

Seems not that easy...

But you could try to find an anwser browsing the code of some open-source projects, e.g. on Koders. I guess all the solutions boil down to checking the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop path in the Windows registry. And probably are Windows-specific.

If you need a more general solution I would try to find an open-source application you know is working properly on different platforms and puts some icons on the user's Desktop.

answered 2009-07-03T20:14:41.657

Your Answer