java wrapper.cratefile failed,Java error failed to create temporary file for jnidispatch library

本文探讨了在安装第三方Java应用时遇到的关于JNA临时文件创建失败的错误,原因可能是读写权限受限。提供了修改/tmp/jna权限、使用系统变量指定新目录等解决策略,并提到了检查文件所有权和可能的影响因素,如其他应用占用同一目录。
摘要由CSDN通过智能技术生成

问题

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值