Change tmp directory for JNA?

3,110 views
Skip to first unread message

Eugene Sun

unread,
Nov 13, 2014, 1:15:17 PM11/13/14
to jna-...@googlegroups.com
Hi all,

I'm currently working under a Linux environment with /tmp mounted with an "no-exec" option. I think this has prevented JNA's initialization from working properly. Specifically, I'm seeing this exception when executing my code:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/jna--1427646616/jna3059406617541829784.tmp: /tmp/jna--1427646616/jna3059406617541829784.tmp: failed to map segment from shared object: Operation not permitted

I was able to get around the problem at this point by specifying "-Djava.io.tmpdir=<some other directory>" when I start JVM, but is there any way I can specify a different tmp directory just for JNA, that doesn't affect the entire JVM? Maybe through another system property, or some other magic? I wasn't able to find any related properties in the documentation.

Thanks very much in advance!

Best,
Eugene

Timothy Wall

unread,
Nov 13, 2014, 3:29:40 PM11/13/14
to jna-...@googlegroups.com
jna.tmpdir will be used if defined.
> --
> You received this message because you are subscribed to the Google Groups "Java Native Access" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jna-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Wellton Barros

unread,
Nov 13, 2014, 4:10:03 PM11/13/14
to jna-...@googlegroups.com
You're making with applet or application desktop? 
Makes a test in debug: new File('address file') then see if the file found.
If found, perhaps DLL version 32, 64 bits.

You can try using an SDK/JRE 32 or 64 bits to test.



Sorry for my english!

Wellton S. Barros
+55 62 9602-0305

Eugene Sun

unread,
Nov 14, 2014, 11:16:00 AM11/14/14
to jna-...@googlegroups.com
Yep it works. Thanks Tim!

Eugene Sun

unread,
Nov 14, 2014, 11:17:04 AM11/14/14
to jna-...@googlegroups.com
Thanks for your help Welton, the problem is with the system property. Setting jna.tmpdir resolved the issue.
Reply all
Reply to author
Forward
0 new messages