Usefull utilities and samples about learning Java and HotSpot VM.
Based on http://www.docjar.com/html/api/sun/jvm/hotspot/tools/PermStat.java.html
You need to add sa-jdi.jar to your class path. This is generally available in your JDK's lib directory. Also, you might need to run this class with super user privileges in order to access the other JVM.
You can install sa-jdi.jar to your local maven repository if you use maven.
mvn install:install-file -Dfile=/usr/local/java/jdk1.7.0_40/lib/sa-jdi.jar \
-DgroupId=sun.jvm.hotspot \
-DartifactId=sa-jdi \
-Dversion=24.0-b56.BuildVersion \
-Dpackaging=jar \
-DgeneratePom=true \
-DcreateChecksum=true
Now, you can add sa-jdi dependency to your pom.xml
<dependency>
<groupId>sun.jvm.hotspot</groupId>
<artifactId>sa-jdi</artifactId>
<version>24.0-b56.BuildVersion</version>
</dependency>
If you use javac
and java
, you should add sa-jdi.jar to your class path like this:
javac -cp ".:$JAVA_HOME/lib/sa-jdi.jar" PrintStringTable.java
java -cp ".:$JAVA_HOME/lib/sa-jdi.jar" PrintStringTable <PID of a running JVM>
sa-jdi docs is here: http://www.docjar.com/docs/api/sun/jvm/hotspot/package-index.html