We would like to know how to get URI from File.
/*from w w w . j a va 2s . com*/ import java.io.File; public class Main { public static void main(String args[]) { try { File testFile = new File("C:\\books\\2004\\test.txt"); System.out.println(testFile.toURI().toString()); } catch (Exception exception) { System.out.println("exception"); } } }
The code above generates the following result.