Extract DLL from within JNA jar file to a custom path

By Sergio Merino

The production environment our Java Web Application is deployed in has several permission restrictions, one of them being unable to write in drive C:

We recently added jna-4.1.0.jar and jna-platform-4.1-0.jar dependencies to be able to read Windows Registry but I’ve noticed that every time server (Tomcat v7.0) is started a DLL file is extracted to a Tomcat temporary folder, giving the following error:

java.lang.UnsatisfiedLinkError: C:Program FilesApache Software FoundationTomcat 7.0tempjna-1319675979jna1892288885647543043.dll: The handle is invalid

I’ve verified that this same DLL is extracted successfully when access permission restriction is removed to ensure this is the source of my problem, but I want to know if there is any way to specify a custom path where that DLL must be extracted to, since we can write in drive E:, for example.

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273