jmap command not found

前端 未结 8 2406
不知归路
不知归路 2021-02-12 11:40

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.

相关标签:
8条回答
  • 2021-02-12 11:43

    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.

    0 讨论(0)
  • 2021-02-12 11:46

    the java path must be in the "PATH" systemproperty.

    $JAVA_HOME/bin
    
    0 讨论(0)
  • 2021-02-12 11:46

    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
    
    0 讨论(0)
  • 2021-02-12 11:47

    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
    
    0 讨论(0)
  • 2021-02-12 11:49

    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
    
    0 讨论(0)
  • 2021-02-12 12:07

    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 ...

    0 讨论(0)
提交回复
热议问题