1/18/2007

Jps output

$JAVA_HOME/bin/jps command lists all java processes, but its output always includes itself, since jps is also a java program. So you will always get at least one entry:

C:\> C:\jdk5\bin\jps -l
1856 sun.tools.jps.Jps
I don't think I ever care about jps process itself. So I always run my wrapper script to filter out sun.tools.jps.Jps:
C:\bin> more jps.bat
@echo off
echo -------------------
C:\jdk5\bin\jps -l | grep -v sun.tools.jps.Jps
In Linux, I simply define a bash alias in $HOME/.bashrc:
alias jps='$JAVA_HOME/bin/jps | grep -v sun.tools.jps.Jps'
Or a tcsh alias in .tcshrc or .cshrc:
alias jps '$JAVA_HOME/bin/jps | grep -v'