1

Jar1 has a properties file name abc.properties and Jar2 also has same file abc.properties. Like this i have more than 100 jars. Is there any mechanism to understand from which jar the abc.properties is loaded.

I know it is based on the precedence from the classpath. But i would like to know the name of the jar from which abc.properties are loaded.

Is there any classloader hook to find the same or any tools that might help.

The application is deployed in weblogic. I can deploy in in Tomcat as well if need be.

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
nsarvesh
  • 37
  • 1
  • 2
  • 9

1 Answers1

0

CodeSource will give you the name of the jar as well as the path of the class inside the jar.

YourClass.class.getProtectionDomain().getCodeSource().getLocation()

CodeSource: https://docs.oracle.com/javase/7/docs/api/java/security/CodeSource.html

Raphael
  • 1,760
  • 1
  • 12
  • 21