Java Path convert to URI
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 w w w.ja va 2s. c o m*/ System.out.println("Absolute Path: " + p.toAbsolutePath()); System.out.println("URI Path: " + uri); } }