问题:
在win10环境下使用java引入 sigar-1.6.4.jar 包,调用sigar提供的接口获取系统信息,已经将 sigar-amd64-winnt.dll 放入C:\Windows\System32 目录下,运行程序报错如下图所示:
打开提示的文件hs_err_pid11644.log文件显示如下:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000010014ed4, pid=9720, tid=0x00000000000010d0
#
# JRE version: Java(TM) SE Runtime Environment (8.0_261-b12) (build 1.8.0_261-b12)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.261-b12 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [sigar-amd64-winnt.dll+0x14ed4]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
原因:
JDK版本 jdk1.8.0_261和sigar-amd64-winnt.dll不匹配,需要降低JDK版本,安装 jdk1.8.0_241。
注:类似问题都考虑JDK版本不匹配造成的,需要更换JDK版本。
解决:
卸载原来安装的jdk-8u261-windows-x64.exe ,
重新下载安装jre-8u241-windows-x64.exe,
配置 jdk1.8.0_241 为JAVA_HOME,
重启程序。
参考:
https://sqa.stackexchange.com/questions/41976/error-while-running-jmeter-perfmon
jdk历史版本下载链接:
https://www.oracle.com/java/technologies/oracle-java-archive-downloads.html