Search
Categories
  ASP.NET
Visual C#
Visual Basic
.NET Framework
ADO.NET
AJAX
LINQ
Java
 
How To Rating
 
0.0 out of 5


Total Votes: 0
         
1 2 3 4 5
 




How to get the Parent Directory of a File in Java

Author: Waqas Anwar - Posted Date: 25-June-2009 - Category: Java   
Bookmark and Share
If you have an absolute path of a file available in file system and you want to obtain the reference of its parent directory you can use getParent() or getParentFile() methods of File class
File file = new File("D:\\Java\\Example.java");

String parentPath = file.getParent();             

File parentDir = file.getParentFile();
LEAVE YOUR COMMENTS LEAVE YOUR COMMENTS
 Name (required)  
 Email (required
 Website


 

 


 
 
 

Categories

My Portfolio

Website Links


Copyright @ 2009 EzzyLearning.com