How to get the Desktop path in java

Solution 1:

I use a french version of Windows and with it the instruction:

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

works fine for me.

Solution 2:

I think this is the same question... but I'm not sure!:

In java under Windows, how do I find a redirected Desktop folder?

Reading it I would expect that solution to return the user.home, but apparently not, and the link in the answer comments back that up. Haven't tried it myself.

I guess by using JFileChooser the solution will require a non-headless JVM, but you are probably running one of them.