However, as soon as I tried using the same commands on my Windows 7 machine, the command just didn't do anything. I did search online and found no references on why it doesn't work the way it is supposed to on Windows. Didn't spend too much time finding what the root cause was either. The workaround is sufficient for me. :)
So, lets see how to get this jmap working on Windows.
Open a command window and start any Java program you have. Make sure it runs for a while so you can use this process ID to get the heap dump.
Run the jps command to get the process ID's. jps is the Java Virtual Machine Process Status Tool.
Now that you have the process ID's for the applications running, start the jmap command on another command prompt. This is where things get interesting.
jmap should have worked here, since it is in the path. However, it doesn't dump the heap and keeps displaying the usage instructions.
I tried several options, none seemed to work.
At this point, I decided to run the jmap command from the bin folder of the JDK to see if anything changes.
And like a charm, jmap dumped the contents of the heap.
Once you have the contents of the heap, use jhat the Java Heap Analysis Tool to view and browse through the heap dump file.
Below are links for the various JDK Tools: