Identifying the source of a Class file

Sometimes you may need to identify the jar file from where a specific Class has been loaded. This information is useful when you need to deal with some weird ClassLoader issues. The following API may help you here.
YourClz.class.getProtectionDomain().getCodeSource().getLocation();

Comments

Very nice! I was missing this.
Also there are some tools to get that jar of a class when you have ClassNotFoundException

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of my employer.