This is a more general description of the bug reported in 4119554.
If an application loads a native library and sets the
runFinalizersOnExit flag to true, the VM will crash
on exit if there are any objects that have a finalizer
and the finalizer needs to call a native function in
The reason is apparently that the
finalizer for the native library classloader unloads the users DLL
before the object finalizer gets called. When the object finalizer
is called there is no DLL and hence the crash.
Test case is attached.