1

I have same class file in my workspace as well as in jar file also (Which i had imported ) How can i know which file is being called at run time ??

I am confused because, in Eclipse, when i press Open Declaration on the instance, it shows the jar version . And when I kept some system outs on to the local copy, they are being called ??

Please tell me how can i know what file is being called ??

I was talking about these code:

Props.getProperty(clientID + ".MetaPI", true);

This Props class exists in both the jar and in local copy also.

Pavan Kumar
  • 211
  • 1
  • 5
  • 8

4 Answers4

1

whatever is first on your classpath should be called, in ideal case that should be the classes folder hence your class file.

sudmong
  • 2,036
  • 13
  • 12
1

try something like this:

System.out.println(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
astrograph
  • 48
  • 7
0

You can start your application with java -verbose. This logs which classes are loaded by the class loader

Guenter
  • 16
  • 2
0

This probably might help:

this.getClass().getProtectionDomain().getCodeSource().getLocation();
jFrenetic
  • 5,384
  • 5
  • 42
  • 67