]> git.sven.stormbind.net Git - sven/jattach.git/blob - README.md
New upstream version 2.0
[sven/jattach.git] / README.md
1 ## jattach
2
3 ### JVM Dynamic Attach utility
4
5 The utility to send commands to remote JVM via Dynamic Attach mechanism.
6
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.
9
10 This is the lightweight native version of HotSpot Attach API  
11 https://docs.oracle.com/javase/8/docs/jdk/api/attach/spec/
12
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
24
25 ### Download
26
27 Binaries are available on the [Releases](https://github.com/apangin/jattach/releases) page.
28
29 On some platforms, you can also [install](#installation) jattach with a package manager.
30
31 ### Examples
32 #### Load native agent
33
34     $ jattach <pid> load <.so-path> { true | false } [ options ]
35
36 Where `true` means that the path is absolute, `false` -- the path is relative.
37
38 `options` are passed to the agent.
39
40 #### Load Java agent
41
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.
44
45     $ jattach <pid> load instrument false "javaagent.jar=arguments"
46
47 #### List available jcmd commands 
48
49     $ jattach <pid> jcmd "help -all"
50
51 ### Installation
52 #### FreeBSD
53
54 On FreeBSD, you can use the following command to install `jattach` package:
55
56     $ pkg install jattach
57
58 #### Alpine Linux
59
60 On Alpine Linux, you can use the following command to install `jattach` package from the edge/community repository:
61
62     $ apk add --no-cache jattach --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/
63
64 #### Archlinux
65
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`:
67
68     $ yay -S jattach