Java File get absolute path
import java.io.File; public class Main { public static void main(String[] args) throws Exception { // Create a File object File myFile = new File("Main.java"); System.out.println("Absolute Path: " + myFile.getAbsolutePath()); }// ww w .j av a2 s. c o m }