jmap命令在linux系统执行不了问题解决

linux-6fd3:~ # jmap -histo 4157 | jmap -histo:live 4157 > a.txt
Attaching to process ID 4157, please wait...
Exception in thread "main" sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 1.5.0, 1.5.0_xx. Target VM is 20.6-b01
        at sun.jvm.hotspot.runtime.VM.checkVMVersion(VM.java:196)
        at sun.jvm.hotspot.runtime.VM.(VM.java:235)
        at sun.jvm.hotspot.runtime.VM.initialize(VM.java:287)
        at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:576)
        at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:476)
        at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpotAgent.java:314)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:146)
        at sun.jvm.hotspot.tools.JMap.main(JMap.java:126)

原因:
JVM version不匹配。系统中有多个JDK安装。

解决:
指定具体的jmap
$ /usr/java/jdk1.6.0_31/bin/jmap -heap 4157


Attaching to process ID 4157, please wait...

Debugger attached successfully.
Server compiler detected.
JVM version is 20.6-b01


using thread-local object allocation.
Parallel GC with 8 thread(s)


Heap Configuration:
   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 8589934592 (8192.0MB)
   NewSize          = 1310720 (1.25MB)
   MaxNewSize       = 17592186044415 MB
   OldSize          = 5439488 (5.1875MB)
   NewRatio         = 2
   SurvivorRatio    = 8
   PermSize         = 21757952 (20.75MB)
   MaxPermSize      = 85983232 (82.0MB)


Heap Usage:
PS Young Generation
Eden Space:
   capacity = 2753888256 (2626.3125MB)
   used     = 2629075304 (2507.281593322754MB)
   free     = 124812952 (119.0309066772461MB)
   95.46775539174237% used
From Space:
   capacity = 52035584 (49.625MB)
   used     = 25823320 (24.627037048339844MB)
   free     = 26212264 (24.997962951660156MB)
   49.62627113015586% used
To Space:
   capacity = 53477376 (51.0MB)
   used     = 0 (0.0MB)
   free     = 53477376 (51.0MB)
   0.0% used
PS Old Generation
   capacity = 2547777536 (2429.75MB)
   used     = 1522552664 (1452.0193710327148MB)
   free     = 1025224872 (977.7306289672852MB)
   59.760031733006066% used
PS Perm Generation
   capacity = 39583744 (37.75MB)
   used     = 38637640 (36.84772491455078MB)
   free     = 946104 (0.9022750854492188MB)
   97.60986732331332% used
linux-6fd3:~ # 

你可能感兴趣的:(LINUX)