Here you can find the source of desktopDirectory()
public static String desktopDirectory()
//package com.java2s; //License from project: LGPL import java.io.File; import javax.swing.filechooser.FileSystemView; public class Main { public static String desktopDirectory() { FileSystemView filesys = FileSystemView.getFileSystemView(); return filesys.getHomeDirectory().getAbsolutePath() + File.separator; }// ww w .j a v a2 s. c o m }