no not JMX. maybe what i am looking for is how can i use JVM TI? i want to access the JVM (Java Virtual Machine) and just display its memory state. for that i need to be able to locate the JVM first and then i need some way to talk to jvm so that i can get how much heap is allocated to it, how much is being used and how much is free..
Anuj Troy wrote:need to write a command line java program to list all the available jvm's and list out their allocated heap memory and used heap memory. can someone give me a sample code.
Try Attach API, it gives you methods to view the available local jvm's along with their process id's
you can then attach to each jvm and use the java management extentions to get the information regarding the memory usage
you can connect to the platform MbeanServer on each jvm's if it already exists
else create one dynamically