Feedback needed: improving System.loadLibrary()
System.loadLibrary() has problems loading JNI libraries that, in turn, depend upon non-JNI libraries. I've seen workarounds floating around advising developers to load the dependencies ahead of time using System.loadLibrary() but aside from being a mess to maintain these workarounds actually break under Webstart: http://bugs.sun.com/view_bug.do?bug_id=6191612
I propose the following enhancement to System.loadLibrary():
Before invoking the win32 loadLibrary() function, append java.library.path to the native search path using SetDllDirectory(): http://msdn.microsoft.com/en-us/library/ms686203(VS.85).aspx
Yes, this only works in more recent versions of Windows but it is a huge step forward in making Java behave more like native applications. Perhaps there is even a way to emulate this behavior using older APIs. I look forward to your feedback.