Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jattach/jattach
JVM Dynamic Attach utility
https://github.com/jattach/jattach
Last synced: about 1 month ago
JSON representation
JVM Dynamic Attach utility
- Host: GitHub
- URL: https://github.com/jattach/jattach
- Owner: jattach
- License: apache-2.0
- Created: 2016-03-29T13:00:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-05T20:43:13.000Z (3 months ago)
- Last Synced: 2024-11-06T00:52:01.877Z (about 1 month ago)
- Language: C
- Homepage: https://github.com/jattach/jattach/releases
- Size: 76.2 KB
- Stars: 971
- Watchers: 22
- Forks: 114
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-hacking-lists - jattach/jattach - JVM Dynamic Attach utility (C)
README
## jattach
### JVM Dynamic Attach utility
The utility to send commands to a JVM process via Dynamic Attach mechanism.
All-in-one **jmap + jstack + jcmd + jinfo** functionality in a single tiny program.
No installed JDK required, works with just JRE. Supports Linux containers.This is the lightweight native version of HotSpot Attach API
https://docs.oracle.com/javase/8/docs/jdk/api/attach/spec/[Supported commands](http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/812ed44725b8/src/share/vm/services/attachListener.cpp#l388):
- **load** : load agent library
- **properties** : print system properties
- **agentProperties** : print agent properties
- **datadump** : show heap and thread summary
- **threaddump** : dump all stack traces (like jstack)
- **dumpheap** : dump heap (like jmap)
- **inspectheap** : heap histogram (like jmap -histo)
- **setflag** : modify manageable VM flag
- **printflag** : print VM flag
- **jcmd** : execute jcmd command### Download
Binaries are available on the [Releases](https://github.com/jattach/jattach/releases) page.
On some platforms, you can also [install](#installation) jattach with a package manager.
### Examples
#### Load native agent$ jattach load <.so-path> { true | false } [ options ]
Where `true` means that the path is absolute, `false` -- the path is relative.
`options` are passed to the agent.
#### Load Java agent
Java agents are loaded by the special built-in native agent named `instrument`,
which takes .jar path and its arguments as a single options string.$ jattach load instrument false "javaagent.jar=arguments"
#### List available jcmd commands
$ jattach jcmd help -all
### Installation
#### Debian, UbuntuOn Debian and Ubuntu, you can install `jattach` from the official repository:
# apt install jattach
#### Alpine Linux
On Alpine Linux, you can install `jattach` package from the edge/community repository:
# apk add --no-cache jattach --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/
#### Archlinux
[jattach](https://aur.archlinux.org/packages/jattach/) package can be installed from [AUR](https://wiki.archlinux.org/index.php/Arch_User_Repository) using one of [AUR helpers](https://wiki.archlinux.org/index.php/AUR_helpers), e.g., `yay`:
# yay -S jattach
#### FreeBSD
On FreeBSD, you can use the following command to install `jattach`:
# pkg install jattach