Hi,
Is there any way to know which all classes are running in jvm at a
given moment? Actually the problem is, I am working on a java
application, and I am not able to trace out which class has the code
for some functionality. I have tried putting break-points to reach the
class but not able to trace.
--
Regards,
Abinash Samal
Tom Hawtin - 17 Mar 2007 09:05 GMT
> Is there any way to know which all classes are running in jvm at a
> given moment? Actually the problem is, I am working on a java
> application, and I am not able to trace out which class has the code
> for some functionality. I have tried putting break-points to reach the
> class but not able to trace.
Ctrl-\ (or Ctrl-Break on Windows) from the console will dump the stacks
of all threads. Or use any old debugger. Or the jstack command. From
within code, Thread.dumpStack() will dump the current stack. For all
threads you can use java.lang.management (since 1.5).
Tom Hawtin
Xiaochuan Fang - 17 Mar 2007 09:11 GMT
Have you ever tried "java -verbose ..."
abinashsamal@gmail.com 写道:
> Hi,
>
[quoted text clipped - 7 lines]
> Regards,
> Abinash Samal
Ingo R. Homann - 19 Mar 2007 10:33 GMT
Hi,
> Is there any way to know which all classes are running in jvm at a
> given moment?
What do you mean with "a class is running"? That seems to be an easy
question, but indeed, it isn't! Classes are *never* "running". A Thread
is running. And a Thread might be running in a pice of code that is
definded in a class. Or a Thread might access some data that is defined
in a class. A Thread might access some data that references another
class. A class might have been "used" (in the manner described above)
some time ago and might be in memory but isn't used any longer (is this
class "running"?)...
What do you mean?
Ciao,
Ingo