Here you can find the source of getDesktopDirectory()
public static File getDesktopDirectory()
//package com.java2s; /**/*from w ww . j av a 2s . c om*/ * <p> * Utilities for manipulating Paths, Files, Directories, etc. * </p> * <p> * <span class="BSDLicense"> This software is distributed under the <a * href="http://hci.stanford.edu/research/copyright.txt">BSD License</a>.</span> * </p> * * @author <a href="http://graphics.stanford.edu/~ronyeh">Ron B Yeh</a> (ronyeh(AT)cs.stanford.edu) */ import java.io.File; import javax.swing.filechooser.FileSystemView; public class Main { /** * @return on a Windows System, the user's Desktop Directory */ public static File getDesktopDirectory() { return FileSystemView.getFileSystemView().getHomeDirectory(); } }