title: How do I access memory usage programmatically via JMX?
body: <p>I'm looking for sample Java JMX code to access the values of JMX attributes from another VM.</p>
  
  <p>With JConsole, I have no problem looking at java.lang/Memory/Attributes/HeapMemory</p>
  
  <p>How would I get the same information from a Java program running in a VM?</p>
  
  <p>Examples of any command line options needed, or other things that need to be started appreciated. </p>