Social Icons

Identify from which JAR file the class was loaded

It's a very common situation that Java developers, especially web developers face in day to day work field that a class with same name exists in two different JAR files even sometimes with same package name. A classic example is logger classes or servlet / jsp related classes, or when libraries from server gets loaded first ignoring the application's library set.

While we all know the remedy is to remove the conflicting JAR file but it becomes cumbersome to determine from what location the offending class is getting loaded.

To solve this we present you the simple java code which you can run as a JSP page, or a Servlet or standalone code by modifying accordingly and determine the path as well as the JAR from which the offending version of the class is getting loaded.

Note that you just need to edit the fully qualified class name to get the details.
The code is pretty self explanatory and hope doesn't needs any further explanation.

Thank you for visiting, feel free to post your comments back!