How to explore which classes are loaded from which JARs?

Passing the verbose:class switch to the java command will print each class loaded and where it was loaded from.

Passing the -verbose:class switch to the java command will print each class loaded and where it was loaded from. Joops is also a nice tool for finding missing classes ahead of time.

I have just tried -verbose:class option. Is awesome! Really really helpful – OscarRyz Jun 3 '09 at 21:04 Nice - Joops looks cool - do you know if it is smart enough to follow a class referenced through Class.

ForName? – cwash Jun 3 '09 at 22:08 I would be surprised if it could follow Class. ForName references, but I don't know for sure.

Joops also has a which command, so you could use that to manually check for classes by name. – Jason Day Jun 4 '09 at 12:19.

From code you can call: myObject.getClass(). GetProtectionDomain().getCodeSource() (Note, getProtectionDomain may unfortunately return null (bad design), so "proper code" would check for that. ).

– cwash Jun 3 '09 at 21:13 Presumably if you get a ClassNotFoundException then you presumably already know the class is not in any of the jars. (Assuming you are not playing with class loaders.) There may be issues if there are other errors during class loading, like a missing superclass. – Tom Hawtin - tackline Jun 3 '09 at 23:25.

Jason Day has it right, this basically a duplicate of a question I asked not so long ago. stackoverflow.com/questions/779650/where....

There is an MBean for the JVM flag mentioned by Jason Day above. If you are using JBoss, you can twiddle this on demand using JMX, if you add the native JMX MBean server to your config. Add the following -D's: -Dcom.sun.management.jmxremote.

Port=3333 -Dcom.sun.management.jmxremote. Authenticate=false -Dcom.sun.management.jmxremote. Ssl=false -Djboss.platform.

Mbeanserver -Djavax.management.builder. Initial=org.jboss.system.server.jmx. MBeanServerBuilderImpl -DJBOSS_CLASSPATH="../lib/jboss-system-jmx.

Jar" And then you can see this setting under the java. Lang:Classloading MBean and can cut it on/off on the fly. This is helpful if you only want it on while executing a certain piece of code.

There is also an MBean which will allow you to enter a fully qualified classname and see where it was loaded from in the class hierarchy. The MBean is called LoaderRepository and you'll want to invoke the displayClassInfo() operation, passing in the FQCN.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions