Here you can find the source of getUri(File file)
public static String getUri(File file)
//package com.java2s; /* The contents of this file are subject to the Mozilla Public License */ import java.io.File; import java.net.URI; public class Main { public static String getUri(File file) { URI uri = file.toURI();/*from w w w . ja v a2s . com*/ return uri.toASCIIString(); } }