问题
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.(Native.java:109)
at com.sun.jna.Pointer.(Pointer.java:42)
at com.sun.jna.PointerType.(PointerType.java:25)
at com.sun.jna.ptr.ByReference.(ByReference.java:32)
at com.sun.jna.ptr.IntByReference.(IntByReference.java:22)
at com.sun.jna.ptr.IntByReference.(IntByReference.java:18)
at org.rzo.yajsw.os.posix.PosixProcess.(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
回答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.
回答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.
回答3:
You don't have permission to write file on that location
回答4:
You're likely to have another application using the same directory, /tmn/jna, in such a way to have changed its ownership. In my case it was the Hudson CI.
You can check which application has ownership on '/tmp/jna' by typing 'ls -l /tmp'.
Chmod /tmp/jna to grant access to anyone (or to your current user) and things will come back to normality.
回答5:
even after downloading specific required file or everything, we could face this error.
a file creation fail could be due to following reasons:
1. user permission/s (inheritance manhandled).
2. corrupt file.
3. file being accessed by another application at the same time.
4. file being locked by anti-malware / anti-virus software.
strangely my antivirus detected adb, avd and jndispatch.dll files as unclean files.
i had to restore them from AVG vault.
configure AVG to ignore (add folder to exception list) required folder.
if you are without antivirus and still facing this problem, remember that windows 7 and above have inbuilt 'windows defender'. see whether this fellow is doing the same thing. put your folder in antivirus 'exclusion' list as the vendor is trusted world wide.
this same answer would go to 'Error in launching AVD with AMD processor'.
i didn't had enough reputation to answer this question there and there.
来源:https://stackoverflow.com/questions/8655712/java-error-failed-to-create-temporary-file-for-jnidispatch-library