File: toURL()
import java.io.File; import javax.swing.JFrame; public class MainClass extends JFrame { public static void main(String[] a) throws java.net.MalformedURLException { java.net.URL u = new File("GetResource.java").toURL(); System.out.println(u); } }