Determining from Where a Class Was Loaded
import java.net.URL; import java.security.CodeSource; import java.security.ProtectionDomain; public class Main { public Main() { Class cls = this.getClass(); ProtectionDomain pDomain = cls.getProtectionDomain(); CodeSource cSource = pDomain.getCodeSource(); URL loc = cSource.getLocation(); } public static void main(String[] argv) throws Exception { } }