File location to URI
In this chapter you will learn:
Convert file location to URI and URL
URI toURI()
creates a file: URI that represents this abstract pathname.
import java.io.File;
/*from j av a2s.com*/
public class Main {
public static void main(String[] args) {
File file = new File("c:/a.htm");
System.out.println(file.toURI());
}
}
The output:
file:/c:/a.htm
Next chapter...
What you will learn in the next chapter:
Home » Java Tutorial » I/O