Wednesday, November 10, 2010

get Current Folder Path in Java

The following function helps you get the current folder path of your project


@SuppressWarnings("finally")
public String getCurrentFolderPath() {
String path = "";
try {
path = new java.io.File(".").getCanonicalPath();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
return path;
}
}

Hope this helps :)

No comments:

Post a Comment