dorkbox / JNA

Native JNA extensions for Linux, MacOS, and Windows
Other
1 stars 2 forks source link

Does not work if Windows username contains non-ASCII characters #2

Open Nohus opened 5 months ago

Nohus commented 5 months ago

This is a JVM bug, where you cannot load .dll files from paths containing non-ASCII characters. Because the JNA.dll is loaded from a path inside of the users home directory, if the username contains non-ASCII characters (as it would in most of the world), the library fails to load.

The workaround is to load it from a temp directory outside of the user home directory. Here is how I solved this for another library, where I have control over the temp directory, might be useful as an example: https://github.com/RiftIntelFusionTool/RIFT/blob/release/src/main/kotlin/dev/nohus/rift/database/SqliteInitializer.kt

Exception:

UnsatisfiedLinkError
C:\Users\문제가있는\AppData\Local\Packages\MyApp\LocalCache\Local\Temp\jna-51826819\jna7206761150339630826.dll: Can't find dependent libraries

(This in turn makes the tray icon library not work for these users)