There two ways to achieve this:
- By using user.home property
String path = System.getProperty("user.home") + File.separator +"Desktop";
- By using FileSystemview
FileSystemView view = FileSystemView.getFileSystemView(); File file = view.getHomeDirectory(); String path = file.getPath();