Java tutorial
import java.io.File; import java.net.URI; public class Main { public static void main(String[] args) { File f = new File("c:/a/b/a/test.txt"); // returns the uri string URI uri = f.toURI(); System.out.println("uri: " + uri); } }