How to get the current working directory in Java
Written on January 10, 2010 at 9:33 am by
mkyong
The current working directory is the root folder of where your current Java project is running, it can be retrieve by using the system property function.
String workingDir = System.getProperty("user.dir");
Example
package com.mkyong.io; public class App{ public static void main (String args[]) { String workingDir = System.getProperty("user.dir"); System.out.println("Current working directory : " + workingDir); } }
Output
Current working directory : E:\workspace\HibernateExample
Oracle Magazine (Free)
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world\'s largest enterprise software company.
Publisher : Oracle Corporation



[...] http://www.mkyong.com/java/how-to-get-the-current-working-directory-in-java/ [...]
nice tip, i’ve subscribed to your rss.
thanks for sharing