In Eclipse and a class is being loaded that should not be possible. In debug mode, I can pause it and see a call to class a.b.c BUT a.b.c class should exist anywhere since it has been renamed. My assumption is that there is an old jar file being called...but I cannot find it. So how do I find the jar file that class a.b.c is in while in debug mode in eclipse ? Either through an eclipse menu option or via Java and using reflection to get the object to tell me its own jar file.
Thanks.
To find the . jar files that contain a class, you can use the FindClass.sh script.
A JAR file may contain a manifest file, that is located at META-INF/MANIFEST. MF . The entries in the manifest file describe how to use the JAR file. For instance, a Classpath entry can be used to specify other JAR files to load with the JAR.
You can use the class loader to retrieve the URL of a resource. This works also for classes. To get the location of the java.lang.String
class:
X.class.getClassLoader().getResource("java/lang/String.class");
Output:
jar:file:/C:/Program%20Files/Java/jdk1.6.0_17/jre/lib/rt.jar!/java/lang/String.class
If you fire up your JVM using -verbose:class (you can set this as a JVM option in Eclipse) you can see exactly which classes are being loaded when, and I think from where.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With