Obtain from where a Class is loaded
public class Main { public static void main(String args[]) { Main m = new Main(); System.out.println(m.getClass().getName() + " is loaded from " + m.getClass().getProtectionDomain().getCodeSource().getLocation()); } }