Go to >> Java Tutorials
Target audience: Beginners
Sometimes we run into issue like loading a class from unexpected location or from JAR file in a different place. We might have placed the JAR in one location but there could be same JAR loaded from different location by class loader based on the class loading preferences but we could found difficulties to resolve the issue. In this kind of scenarios, we might need to find the actual JAR file from which the class files was loaded.
How can we find the loaded classes and its JAR files from which they were loaded?
Java has an JVM option -verbose:class. if we run the JVM with this option, then it will list out all classes thar are loaded by JVM and those classes’s JAR file with location. This will be really helpful resolving loading classes from unexpected JAR files.
E.g:
C:\Projects\MyWork>java -verbose:class org.test.TestMyClass
If you wish you can try out an opensource tool called Joops too.
No comments:
Post a Comment