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

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

    ReplyDelete

Post a Comment