How can I get current working directory?

Category: java.io, viewed: 1127 time(s).
 
package org.kodejava.example.io;
 
public class CurrentDirectoryExample 
{
	public static void main(String[] args) {
		//
		// System property key to get current working directory.
		//
		String USER_DIR_KEY = "user.dir";
		String userHomeDir = System.getProperty(USER_DIR_KEY);
		
		System.out.println("Working Directory: " + userHomeDir);
	}
}
 
 

Result example:

Working Directory: C:\Workspace\java-api-example
Bookmark this example!  

Most Viewed Examples

Google

100 Top & Latest


eXTReMe Tracker
visitor stats