Getting a Proper URL from a File Object

20/12/2011 10:36

import java.io.*;
import java.net.*;

public class FileURL {
  public static void main(String args[]) throws MalformedURLException {
    File file = new File("The End");
    URL url2 = file.toURI().toURL();
    System.out.printf("Good url %s%n", url2);
  }
}

 

Back

Search site

Copyright © 2012 Dadaso Zanzane. All rights reserved.