How to find out which jar file a class is loaded from

There are ways to programmatically find out where the java classloader loads a certain class from. But what if you don't have access to the source code and are on a production environment.
In these cases JVM provides you with a nice option :
-verbose:class

So if you are working with a an app server like WebLogic or Tomcat, just modify the appropriate script that sets JVM arguments and you should be able to see output like this in your server log :

 [Loaded java.io.Serializable from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.lang.Comparable from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded java.lang.CharSequence from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
..............................................................................
..............................................................................
..............................................................................