How to find out where a java class was loaded from?

If you need to find out which jar file a Java class was loaded from you can find out by examining the code source location in the protection domain:

MyClass.class.getProtectionDomain().getCodeSource().getLocation()

Leave a Reply

Your email address will not be published. Required fields are marked *