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.
OpenJDK on centos doesn't include the jmap utility. test on another platform or use the jhat java_pid1234.hprof
command to examine the dump after the fact on another platform.
jhat can be slow to run on large dumps and even run out of memory! I use jhat -port 7000 -J-mx2048m java_pid1234.hprof
so you'll need plenty of ram on your computer.
the java path must be in the "PATH" systemproperty.
$JAVA_HOME/bin
it doesn't come default with JRE -- you should be able to install it with below command
yum install java-1.8.0-openjdk-devel-debug
My situation was a little strange (running inside the openjdk:8-jre
Docker image), but this combination worked
cat /etc/debian_version # 8.6
apt install -t jessie-backports openjdk-8-jre-headless ca-certificates-java
apt-get install -f -y openjdk-8-jdk-headless
apt-get install -f -y openjdk-8-dbg
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
I found that on my system (elasticsearch container) it is excluded:
$ grep exclude /etc/yum.conf
exclude=java-1.8.0-openjdk*
If I comment it out then I can see and install this package with yum install ...