jps and other lesser known tools from the Java JDK bin

I recently needed to programmatically find out which java.exe was running which application. Simple on Linux using the output of the ps command, simple on Windows 7 with the tasklist command. But not so on Windows XP, where tasklist doesn’t provide the invoking command line string for each process. I could have used the WMIC tool, but I didn’t have this available.

So after a bit of Googling I came across the JVM Process Status Tool (jps) tool, which has just the output I need.

This led me to wonder what the other tools in the bin folder that I don’t use are, turns out they’re documented on this page – JDK Tools and Utilities. Quite a few of them are experimental, here are a few ones of general interest:

  • jdb – command line debugger
  • javap – class file disassembler
  • native2ascii – convert text to Unicode Latin-1 (useful for Resource Bundles in particular)
  • serialver – returns serialVersionUID of a class
  • keytool – key and certificate management
  • jstat – statistics monitoring for a JVM
  • jconsole – JMX compliant graphical monitoring tool
  • jvisualvm – JVM monitoring tool
  • jinfo – configuration info for a process/core file
  • jhat – heap dump browser (launches a web server so you can view it in your browser)
  • jmap – memory map for a process/core file
  • jsadebugd – “attaches to a Java process or core file and acts as a debug server”, seems would be useful if you needed to debug an application that wasn’t started in debug mode
  • jrunscript – command line script shell, using JavaScript by default (turns out this is Mozilla Rhino)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s