jps was introduced in JDK 1.5 on all platforms. I used to run
ps -ef | grep java all the time to get the pid of java programs, or just to see if my appserver is running or not. Now with jps, I no longer need this ps+grep, or windows task manager.
# list pid and short java main class nameSo
# list pid and fully-qualified java main class
# pid, full main class name, and application arguments
2152 org.apache.catalina.startup.Bootstrap start
2024 sun.tools.jps.Jps -lm
# pid and JVM options
1320 Jps -Dapplication.home=C:\tools\jdk5 -Xms8m
2152 Bootstrap -Djava.endorsed.dirs=c:\tools\jakarta-tomcat-5\common\endorsed
jps -lvmgives the similar result to
It's a little annoying to see jps itself is included in the output. Running jps with no options just lists the short name of the java main class, which isn't very useful in most cases. You can't tell
However, if you are running Tomcat 6.x or 7.x, and using JDK 1.6.0_23 or 1.6.0_24, Tomcat process will not show up in the jps output, or jvisualvm screen. This is because Tomcat uses a custom java.io.tmpdir (-Djava.io.tmpdir=$CATALINA_BASE/temp) but jps and jvisualvm in JDK 1.6.0_23 or 1.6.0_24 always looks for java processes under the default java.io.tmpdir(the file hsperfdata_$USER). For more details, see https://issues.apache.org/bugzilla/show_bug.cgi?id=50518
It's about jps, not jsp. For more details, see jps docs here.