Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vietj/pid

Simple project showing how to obtain the JVM PID with the JVM attach API
https://github.com/vietj/pid

Last synced: 5 days ago
JSON representation

Simple project showing how to obtain the JVM PID with the JVM attach API

Awesome Lists containing this project

README

        

An hack showing how to obtain the process ID of a JVM using the JVM attach API.

The Main class has two main methods:
- the classic main method iterates over all the virtual machine found using the JVM attach API. Each found JVM will be attached an agent (the same class) that will determine if the JVM is the same as the originating host (through a simple system property)
- the other main method named "agentmain" is executed when the agent is loaded

The example can be executed with a "java -jar PID.jar".

Read http://blog.igorminar.com/2007/03/how-java-application-can-discover-its.html to find other ways to discover a JVM process id.

have fun

Julien