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-1.6.0.00 -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 :
#!/bin/bash
for i in $( jps | grep -v Jps | awk -F " " '{print $1}' ) ; 
do
   echo
   jinfo $i | grep -E "(java.class.path|library.path)"
   jps -mlvV | grep $i
done

1 comment:

mary Brown said...

Thanks for the post, I am techno savvy. I believe you hit the nail right on the head. I am highly impressed with your blog. It is very nicely explained. Your article adds best knowledge to our Java Online Training from India. or learn thru Java Online Training from India Students.