Load the class source location from Class.getResource() in Java
Description
The following code shows how to load the class source location from Class.getResource().
Example
/*from w w w.j ava 2 s.c om*/
public class Main {
public static void main(String args[]) {
Class theClass = Main.class;
java.net.URL u = theClass.getResource("yourPath/icon.gif");
System.out.println("This class (FromWhere) is located at : " + u);
}
}
The code above generates the following result.