DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Which Class File Is Loaded By The Classloader ?

03.23.2007
| 11093 views |
  • submit to reddit
        When using lots of third-party libraries, one problem might be that 2 of them package different versions of the same class, producing errors when method version conflicts happen.

Here is a simple way to know the exact location used by the classloader to get your class :

URL myClassURL = MyMysteryClass.class.getProtectionDomain().getCodeSource().getLocation();