We are moved to new domain
Click -> www.ehowtonow.com
Tuesday, 23 May 2017

How to retrieve present working directory using Java

CurrentWorkingDirectory.java
package com.javatutorialcorner.directory;

public class CurrentWorkingDirectory {

 public static void main(String[] args) {
  getCurrentWorkingDirectory();

 }

 private static void getCurrentWorkingDirectory() {
  String userDirectory = System.getProperty("user.dir");
  System.out.println("Present Working Directory : " + userDirectory);

 }
}
Output

Present Working Directory : C:\Users\annamalait\workspace\Test143

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

Item Reviewed: How to retrieve present working directory using Java Rating: 5 Reviewed By: eHowToNow