【发布时间】:2016-12-17 20:00:36
【问题描述】:
我正在使用 java 制作 CD 刻录机,其中(使用 JNI)我必须加载一些本地库 (DLL)。好吧,我知道要使用“System.loadLibrary(libName)”加载本机库,该库必须设置为“java.library.path”路径之一,但是如果在那里使用“System.load(libPath)”没必要。
所以,我曾经使用“System.load(libPath)”加载我的所有本机库,除了一个 "BurnerCaller.dll" 会导致 JVM 崩溃并出现以下错误消息外,这对所有本机库都有效.
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (0xe0434352), pid=2280, tid=0x00000000000013a8
#
# JRE version: Java(TM) SE Runtime Environment (8.0_92-b14) (build 1.8.0_92-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.92-b14 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [KERNELBASE.dll+0xaa7d]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Program Files\Java\MainWorkspace\NewAman\hs_err_pid2280.log
#
# 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.
Here是详细结果错误。
奇怪的是,当且仅当我把这个库放到当前运行的JRE 或JDK 的“bin”目录中(我的应用程序正在运行)它就像一个魅力。
任何帮助将不胜感激,在此先感谢。
【问题讨论】:
-
你真的有多个原生库包含JNI代码吗?通常你只会有一个,它会有 DLL 引用到它使用的任何其他本机东西。
-
不,它只是一个包含 JNI 代码的独特库
-
所以这是您需要加载的唯一库。
-
@Mdev,请将 hs_err_pid2280.log 附加到您的问题中,这将有助于发现问题
-
你好 SerCe,我已经编辑了我的帖子,所以请在上面的帖子中找到 hs_err 文件的保管箱链接。
标签: java jvm java-native-interface