0

This might be a silly question,but is there a way to find loaded classes in a JVM. Particularly classes that are loaded in to tomcat? Thanks in advance.

Dropout
  • 13,653
  • 10
  • 56
  • 109
Maxi
  • 285
  • 6
  • 20
  • Why do you need to do this? Are you trying to find out whether the class has been loaded by a specific class loader, or by any classloader within your JVM? – DNA Dec 16 '13 at 15:21

2 Answers2

2

You might want to use tools like YourKit or JProfiler to see the usage of classes on your server. Another option that comes to my mind is to use JVM Monitor plugin, if you're using Eclipse.

Dropout
  • 13,653
  • 10
  • 56
  • 109
  • 1
    There are also [VisualVM](http://visualvm.java.net/) and [Java Mission Control](http://www.oracle.com/technetwork/java/javaseproducts/mission-control/index.html) which are distributed with the latest JDK. Look for jvisualvm.exe and jmc.exe on Windows. – Mustafa Ulu Dec 16 '13 at 15:43
1

If you run java with the -verbose:class option, it will show what classes are being loaded - is that what you meant?

See also

Note also that the same classfile can be loaded into a single JVM by multiple classloaders; each one will be treated as a distinct class by the JVM.

Community
  • 1
  • 1
DNA
  • 42,007
  • 12
  • 107
  • 146
  • I tried that command it only shows the classes relevant java itself. Not the user classes!. – Maxi Dec 16 '13 at 13:32
  • What I need is; suppose there is a class "foo.baa.Foo.class" in one of my jar in WEB-INF/lib in a *.war file. When my application is up and running is there a way to find that "Foo" class in actually loaded to the JVM or not. Or in other mean list all the class files that are loaded in to JVM. – Maxi Dec 16 '13 at 13:37
  • Ya! I'm trying to find a particulate class is loaded or not. – Maxi Dec 18 '13 at 12:56