Java examples for File Path IO:Path
Getting an Absolute Filename Path from a Relative Filename Path
import java.io.File; public class Main { public void m() { File file = new File("filename.txt"); file = file.getAbsoluteFile(); // c:\temp\filename.txt file = new File("dir" + File.separatorChar + "filename.txt"); file = file.getAbsoluteFile(); // c:\temp\dir\filename.txt file = new File(".." + File.separatorChar + "filename.txt"); file = file.getAbsoluteFile(); // c:\temp\..\filename.txt // Note that filename.txt does not need to exist }//from w w w .ja va2 s.com }