• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to find the Time of class loaded by jvm  RSS feed

 
Majid Ahmed
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok I have been searching for this for weeks now.

I am trying to write a small program that will look up all the classes that have been loaded by JVMs.
I am using MonitoredHost and MonitoredVM to lookup all the classes/jars.


Is there a way I can find out what time the classes were loaded?


Thanks.
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know how to do this with code however if you just want to know which classes are loaded then use: java -verbose:class ClassFile
 
pankaj vijay
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Majid i am not sure on this but logically static variables are initialized when a class is loaded by the JVM. so if we try to initialize a static variable by system time it can be possible.. like this..



as i think it will initialize time variable very first at the time of class loading as it is static variable. so it should assign current time(class loading time). If there is any other good way then please post.
 
Suhas Bilaye
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I think Pankaj is correct. If you want to test this you can load the class dynamically (using Class.forName ) and print the value of the static variable.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!