Program to Find current directory or current path in java









Program to Find current directory or current path in java >





/** JavaMadeSoEasy.com */
public class CurrentDirectory {
   public static void main(String[] args) {
          String currentPath = System.getProperty("user.dir");
          System.out.println("currentPath = "+ currentPath);
   }
}
/*OUTPUT
currentPath = E:\workspace\FileHandling
*/


RELATED LINKS>
Create new File in current or specified directory >

Create File using createNewFile() method in java file IO


Create File in current path using new File(currentPath, fileName), File.separator or System.getProperty("file.separator") in java file IO


No comments:

Post a Comment