Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/vietj/pid
- Owner: vietj
- Created: 2011-10-01T22:51:00.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-10-01T22:55:44.000Z (over 13 years ago)
- Last Synced: 2024-11-08T20:49:55.646Z (about 2 months ago)
- Language: Java
- Homepage:
- Size: 85.9 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README
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 loadedThe 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