Tuesday, October 09, 2007

Tools for every day from JDK 6

JDK 6 introduced some usefull tools:

1. JPS - (Also incuded in JDK 5) lists all running JVMs (also those loaded from JNI !!!) with information for them as passed arguments and the  name of the application's main class with its arguments:
$jps -mlvV
3370 sun.tools.jps.Jps -mlvV -Dapplication.home=/usr/lib/jvm/java-6-sun- -Xms8m
30707 -Xms512m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=128m
3327 tcpmon.MainWindow

2. JINFO - prints Java configuration information for a given Java process. The most usefull info as sun.boot.library.pathjava.library.path and java.class.path can be filtered:
$jinfo 30707| grep -E "(java.class.path|library.path)"

Those tools can be combined to expract the most usefull information for all JDK6 in a BASH script ( jpall.sh)  skipping the JPS process itself :
for i in $( jps | grep -v Jps | awk -F " " '{print $1}' ) ; 
   jinfo $i | grep -E "(java.class.path|library.path)"
   jps -mlvV | grep $i

No comments: