jmap Caused by: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are...

查询JVM内存时,运行jmap,发现报错:

jmap -heap 88301
Attaching to process ID 88301, please wait...
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at sun.tools.jmap.JMap.runTool(JMap.java:197)
        at sun.tools.jmap.JMap.main(JMap.java:128)
Caused by: sun.jvm.hotspot.runtime.VMVersionMismatchException: Supported versions are 24.76-b04. Target VM is 25.45-b02
        at sun.jvm.hotspot.runtime.VM.checkVMVersion(VM.java:234)
        at sun.jvm.hotspot.runtime.VM.<init>(VM.java:297)
        at sun.jvm.hotspot.runtime.VM.initialize(VM.java:368)
        at sun.jvm.hotspot.bugspot.BugSpotAgent.setupVM(BugSpotAgent.java:598)
        at sun.jvm.hotspot.bugspot.BugSpotAgent.go(BugSpotAgent.java:493)
        at sun.jvm.hotspot.bugspot.BugSpotAgent.attach(BugSpotAgent.java:331)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:163)
        at sun.jvm.hotspot.tools.HeapSummary.main(HeapSummary.java:40)
        ... 6 more


原因是机器上安装了多个JDK。
解决方案:
查看当前服务使用的JDK版本,然后使用带路径的jmap指令解决

你可能感兴趣的:(错误志,java,开发语言)