Determine which JAR file a class is from I am not in front of an IDE right now, just looking at the API specs. CodeSource src = MyClass.class.getProtectionDomain().getCodeSource(); if (src != null) { URL jar = src.getLocation(); } I want to determine which JAR file a class is from. Is this the way to do it?Yes. It works for all classes except classes loaded by bootstrap classloader. The other wa..