Tuesday, January 15, 2008

jps - Java Virtual Machine Process Status Tool

Once of those nifty tools introduced with Java 1.5 is the jps tool (Java Virtual Machine Process Status Tool). The blog entry Using jps to Find JVM Process Information shows some of the information available via this handy tool. This tool has almost completely replaced my use of ps -ef | grep java when working with Java in Unix or Linux.

The snapshot below (click on image to see larger version) shows some of the basic options of jps in action.



One use of the jps command is in conjunction with the handy JConsole tool to identify the PID of the JVM for to which JConsole should be run against. The document Using JConsole - Java SE Monitoring and Management Guide explains that the ps commands can be used with Linux or Unix systems and that the Task Manager can be used in Windows. However, it points out that jps can be used on all of these operating systems. This universal nature of the jps command makes it very attractive. Not only can it be used on all of these operating systems, but it provides useful output. I especially like the output from the command jps -lm.

3 comments:

freemarket said...

Hi,

Can you hazard a guess as to what "feature" of Windows 2003 would prevent jps from viewing processes that both Windows XP (and linux)
can view?

Thanks,
Henry

@DustinMarx said...

There are a few possibilities that commonly cause Windows users trouble. One possibility has to do with the default Windows temporary directory being on a FAT type system. You can find discussion about work-around of this issue in the jvmstat FAQ. Another common obstacle for Windows users of jps is inappropriate permissions settings in the temp directory. I specifically discuss this issue and its fix in the blog post Making jps and jconsole Work with Java SE 6 on Windows Vista.

freemarket said...

Thanks for response. My particular case was that of not disabling the ssl on the jmxremote. This allowed the remote jconsole to connect.