12:43 am - Monday August 21, 2017

To find file parth using getAbsolutePath()

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

BACK

 

The File.getAbsolutePath() will give you the full complete path name (filepath + filename) of a file.


import java.io.File;

public class FilePath

{

public static void main(String[] args)

{

File f = new File("/home/mathan/Desktop/assignment.txt");

System.out.println("Path =" + f.getAbsolutePath());

}

}

Output

  Path  =/home/mathan/Desktop/assignment.txt

BACK

Filed in: Java Examples

Comments are closed.