Java error failed to create temporary file for jnidispatch library

18,345

Solution 1

I just had this exact same problem; the program had been working fine for months and suddenly this error. Some quick debugging with strace shows that it's trying to open:

/tmp/jna/jna6858279656331549999.tmp

Naturally /tmp/jna was owned by another user, and in my case was a week old. I can't even start to explain how the program had been working properly all day and then suddenly fail because it cannot write to this directory.

Anyhow, I sudo chmod'd /tmp/jna to 777 and now everything's fine. Go figure.

Solution 2

So this application is trying to write to the temp directory. Where is this ? It's OS-specific. I don't know which OS you're running, but you can find the location by using the examples here.

Note that you may be able to use that system property (java.io.tmpdir) to provide a new temp directory location, if you can't change the permissions of where this application is writing to.

Share:
18,345
user837306
Author by

user837306

Updated on June 14, 2022

Comments

  • user837306
    user837306 almost 2 years

    While trying to install a third part java application I got this error Failed to create temporary file for jnidispatch library: java.io.IOException: Read-only file system.

    java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.rzo.yajsw.boot.WrapperExeBooter.main(WrapperExeBooter.java:35)
    Caused by: java.lang.Error: Failed to create temporary file for jnidispatch library: java.io.IOException: Read-only file system
            at com.sun.jna.Native.loadNativeLibraryFromJar(Native.java:751)
            at com.sun.jna.Native.loadNativeLibrary(Native.java:685)
            at com.sun.jna.Native.<clinit>(Native.java:109)
            at com.sun.jna.Pointer.<clinit>(Pointer.java:42)
            at com.sun.jna.PointerType.<init>(PointerType.java:25)
            at com.sun.jna.ptr.ByReference.<init>(ByReference.java:32)
            at com.sun.jna.ptr.IntByReference.<init>(IntByReference.java:22)
            at com.sun.jna.ptr.IntByReference.<init>(IntByReference.java:18)
            at org.rzo.yajsw.os.posix.PosixProcess.<init>(PosixProcess.java:43)
            at org.rzo.yajsw.os.posix.OperatingSystemPosix.setWorkingDir(OperatingSystemPosix.java:10)
            at org.rzo.yajsw.WrapperExe.main(WrapperExe.java:163)
            ... 5 more