Java 为什么`sun.jvm.hotspot.debugger.DebuggerException:无法打开二进制文件`?

Java 为什么`sun.jvm.hotspot.debugger.DebuggerException:无法打开二进制文件`?,java,jvm,Java,Jvm,在linux中,我得到了一个由java生成的核心文件,jvisualvm无法打开它,因此我想将其转换为堆转储文件,但出现了一些错误: [root@root_test-1 game]$ jmap -J-d64 -dump:format=b,file=core.10255.dump java ./core.10255 Attaching to core ./core.10255 from executable java, please wait... Error attaching to core

在linux中,我得到了一个由java生成的核心文件,jvisualvm无法打开它,因此我想将其转换为堆转储文件,但出现了一些错误:

[root@root_test-1 game]$ jmap -J-d64 -dump:format=b,file=core.10255.dump java ./core.10255
Attaching to core ./core.10255 from executable java, please wait...
Error attaching to core file: cannot open binary file
sun.jvm.hotspot.debugger.DebuggerException: cannot open binary file
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach0(Native Method)
        at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.attach(LinuxDebuggerLocal.java:286)
        at sun.jvm.hotspot.HotSpotAgent.attachDebugger(HotSpotAgent.java:673)
        at sun.jvm.hotspot.HotSpotAgent.setupDebuggerLinux(HotSpotAgent.java:611)
        at sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:337)
        at sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:304)
        at sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:156)
        at sun.jvm.hotspot.tools.Tool.start(Tool.java:191)
        at sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
        at sun.jvm.hotspot.tools.HeapDumper.main(HeapDumper.java:83)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at sun.tools.jmap.JMap.runTool(JMap.java:201)
        at sun.tools.jmap.JMap.main(JMap.java:130)

如何修复它?

看起来您使用的是稍旧(JDK8 update 60或更低)的java版本。您提到的问题是已知的问题,它已经在JDK9中修复,并向后移植到不同的较低版本(JDK8更新65是最低版本)。您需要升级java以使用最新版本来避免此问题