4

I have a running jvm process and I want a tool to get classes loaded by that jvm, are there one?

5 Answers 5

12

You can use jmap -histo <PID>

It'll show histogram of loaded classes including classname, number of instances, size, etc

Sign up to request clarification or add additional context in comments.

Comments

4
jinfo <pid> 

will give you quite a bit information, including the classpath and the jars in the path. see here

The jinfo command may be limited by the permissions granted to the principal running the command. The command will only list the JVMs for which the principle has access rights as determined by operating system specific access control mechanisms.

Note also that jinfo is not available on windows or linux itanium.

2 Comments

I have tried it (pastebin link), and noting, what is wrong?
I've amended my info. You're on windows and so out of luck when it comes to jinfo. IMHO, use bot trojanfoe and Umesha Kacha:s answers
3

You can use the following in the command line

java -verbose:class .... 

and the JVM will dump out what it's loading including all its locations

1 Comment

it will put loaded classes into the standard output, so messing with program output isn't it? so how can I redirect it to some other location?
1

try visual VM. It is free but is not distributed with JRE/JDK but you can download it from official oracle website. Also you can make a heap dump and than you can view it by standard tools from JDK.

1 Comment

VisualVM is distributed with (at least) the JDK, no manual download is necessary.
0

If the process has JMX enabled then you can use jvisualvm (bundled with the JDK) to examine such properties.

2 Comments

There is nice tab Classes, but is it possible to see where each Class has come from (file path etc)? Is it possible at all?
No, I'm sorry I don't if there is.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.