I developed an application in C++ to import .DWG files(Autodesk's drawing file). The application is invoked in Java via JNI. Sometimes, the java application closes it self suddenly by an error:
# A fatal error has been detected by the Java Runtime Environment:
# Internal Error (os_windows_x86.cpp:114), pid=4280, tid=2324
# Error: guarantee(result == -1,"Unexpected result from topLevelExceptionFilter")
# JRE version: 6.0_14-b08
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0-b16 mixed mode windows-amd64 )
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
--------------- T H R E A D ---------------
Current thread (0x000000000aa5c800): JavaThread "CommandQueue" daemon [_thread_in_native, id=2324, stack(0x0000000016ff0000,0x00000000170f0000)]
[error occurred during error reporting (printing stack bounds), id 0xc0000005]
(net.iceedge.tools.newimport.assets.RealDWG.getBlockTable() is a native method)
It doesn't happen for all dwg files, just for some of them. I found it was caused by the lack of some DLLs. If I added the path which contains all DLLs from Autodesk to java.library.path, there won't be any error. There're over 100 DLLs and I don't want to put all of them into my application.
My application(a DLL file) can be loaded without any problem by Java, so my first question is: when the DLL is loaded, doesn't Java check all dependent libraries for the DLL?
My second question is: Is there a way to catch this error in my C++ code? Java crashes suddenly is too unfriendly for users. I tried using catch(...), but nothing could be caught.
subject: A fatal error cause JVM crash when running native code(C++) via JNI