• Post Reply Bookmark Topic Watch Topic
  • New Topic

Viewing JVM runtime image  RSS feed

 
Nirmal Mekala Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any java class that is run on a computer, runs in a JVM. Can I see the classes (Class names and their method names) that have been loaded or run in a JVM? The java console can be used only to see the messages that have been printed by System.out or System.err . I want to see the classes that have been executed in the JVM. Something like a call stack.
Are there any Java api to acheive this?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16046
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you run your application from a console window, you get a thread dump in the console window if you press the "Break" key.
 
Joe Ess
Bartender
Posts: 9436
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JConsole, which comes with Sun's JDK 1.5.0, may tell you some of what you need to know. If you want to know what methods were invoked throughout a program's execution, you will probably need something like Borland OptimizeIt, which has a code coverage component.
 
Ulas Ergin
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there must be a jvm parameter to print classnames upon load but i don't remember.

Also see the 'Thread Dump' facility of JVMs which lets you see all the threads and their execution points at the moment you request the dump.
 
Nishant Verma
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the -verbose parameter to print classnames upon load :

java -verbose Myclass

Cheers
Nishant
 
Nirmal Mekala Kumar
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys .. i'll try these out and bug u again
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!