Friday, August 28, 2009

How to Retrieve My Documents path using Java

Using Java System Class, You can easily retrieve My Documents path in Java

Retrieve My Documents path in Java :

String temp = ((System.getenv("USERPROFILE"))+("\\My Documents\\"));
Output : C:\Users\user\My Documents\

File f1 = new JFileChooser().getFileSystemView().getDefaultDirectory();
Output : C:\Users\user\Documents


System.getProperty("user.home")
Output : C:\Users\user

Author : Anuj Patel
Blog : http://goldenpackagebyanuj.blogspot.in/

No comments:

Post a Comment