3 ### JVM Dynamic Attach utility
5 The utility to send commands to a JVM process via Dynamic Attach mechanism.
7 All-in-one **jmap + jstack + jcmd + jinfo** functionality in a single tiny program.
8 No installed JDK required, works with just JRE. Supports Linux containers.
10 This is the lightweight native version of HotSpot Attach API
11 https://docs.oracle.com/javase/8/docs/jdk/api/attach/spec/
13 [Supported commands](http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/812ed44725b8/src/share/vm/services/attachListener.cpp#l388):
14 - **load** : load agent library
15 - **properties** : print system properties
16 - **agentProperties** : print agent properties
17 - **datadump** : show heap and thread summary
18 - **threaddump** : dump all stack traces (like jstack)
19 - **dumpheap** : dump heap (like jmap)
20 - **inspectheap** : heap histogram (like jmap -histo)
21 - **setflag** : modify manageable VM flag
22 - **printflag** : print VM flag
23 - **jcmd** : execute jcmd command
27 Binaries are available on the [Releases](https://github.com/jattach/jattach/releases) page.
29 On some platforms, you can also [install](#installation) jattach with a package manager.
32 #### Load native agent
34 $ jattach <pid> load <.so-path> { true | false } [ options ]
36 Where `true` means that the path is absolute, `false` -- the path is relative.
38 `options` are passed to the agent.
42 Java agents are loaded by the special built-in native agent named `instrument`,
43 which takes .jar path and its arguments as a single options string.
45 $ jattach <pid> load instrument false "javaagent.jar=arguments"
47 #### List available jcmd commands
49 $ jattach <pid> jcmd help -all
54 On Debian and Ubuntu, you can install `jattach` from the official repository:
60 On Alpine Linux, you can install `jattach` package from the edge/community repository:
62 # apk add --no-cache jattach --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/
66 [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`:
72 On FreeBSD, you can use the following command to install `jattach`: