Java Path get absolute path
import java.net.URI; import java.nio.file.Path; import java.nio.file.Paths; public class Main { public static void main(String[] args) { Path p = Paths.get("Main.java"); URI uri = p.toUri();/*from www.j a va 2 s . c o m*/ System.out.println("Absolute Path: " + p.toAbsolutePath()); System.out.println("URI Path: " + uri); } }