Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jmap command not found

Tags:

I'm trying to use the jmap command on my CentOS server but it keeps telling me that the command was not found even though I have the JDK installed.

Here is the output of command java -version:

java version "1.7.0_25" OpenJDK Runtime Environment (rhel-2.3.10.4.el6_4-x86_64) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode) 

How can I fix this issue?

like image 809
user3701420 Avatar asked Sep 07 '14 21:09

user3701420


People also ask

Where can I find JMAP?

jmap. jmap prints heap dumps into a specified file location. This tool is packaged within JDK. It can be found in \bin folder.

Where is JMAP in Linux?

jmap prints shared object memory maps or heap memory details of a given process or core file or remote debug server. NOTE - This utility is unsupported and may or may not be available in future versions of the J2SE SDK. jmap is not currently available on Windows platforms or on the Linux Itanium platform.

How do I run a JMAP command in Linux?

jmap tool is shipped with JDK. Here is how you should invoke it: jmap -dump:live,file=<file-path> <pid> where pid: is the Java Process Id, whose heap dump should be captured file-path: is the file path where heap dump will be written in to. Note: It's quite important that you pass the “live” option in the command line.

What does JMAP do?

jmap is a tool to print statistics about memory in a running JVM. We can use it for local or remote processes. Along with that option, we should specify several parameters: live: if set, it only prints objects which have active references and discards the ones that are ready to be garbage collected.


1 Answers

You should be able to find jmap in the java-1.8.0-openjdk-devel-debug, or java-1.7.0-openjdk-devel-debug, or java-1.6.0-openjdk-devel-debug packages on Redhat/Centos. To install it, run the following as root:

yum install java-1.8.0-openjdk-devel-debug 

For completeness, here's the command to check which packages include jmap:

yum whatprovides '*/jmap' 

Here's a sample output:

1:java-1.6.0-openjdk-devel-1.6.0.37-1.13.9.4.el7_1.x86_64 : OpenJDK Development Environment Repo        : updates Matched from: Filename    : /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.37.x86_64/bin/jmap    1:java-1.7.0-openjdk-devel-1.7.0.91-2.6.2.3.el7.x86_64 : OpenJDK Development Environment Repo        : base Matched from: Filename    : /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64/bin/jmap    1:java-1.8.0-openjdk-devel-1.8.0.65-3.b17.el7.x86_64 : OpenJDK Development Environment Repo        : base Matched from: Filename    : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64/bin/jmap    1:java-1.8.0-openjdk-devel-debug-1.8.0.65-3.b17.el7.x86_64 : OpenJDK Development Environment with full debug on Repo        : base Matched from: Filename    : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64-debug/bin/jmap    1:java-1.8.0-openjdk-devel-debug-1.8.0.65-3.b17.el7.x86_64 : OpenJDK Development Environment with full debug on Repo        : @base Matched from: Filename    : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64-debug/bin/jmap 
like image 197
Leo Avatar answered Oct 06 '22 14:10

Leo