在mac中按应用程序(.jar)读取/写入文件时,权限被拒绝 [英] permission denied error while reading/writing file by application(.jar) in mac

查看:1574
本文介绍了在mac中按应用程序(.jar)读取/写入文件时,权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在swing中创建了一个应用程序,也为同一个应用程序创建了一个安装程序。

I have created an application in swing also created an installer for the same application.

安装程序和应用程序在Windows系统上运行完美。

both installer and the application run perfectly on windows system.

但我的问题是当我尝试在mac os中运行它时,它与所有数据都没有完美运行。

but my problem is when i try to run it in mac os it is not run perfectly with all data.

我找到了在我的应用程序中我使用.xyz类型的属性文件和目录来保存一些数据,所以在mac os。 pre pre用作隐藏文件。

I have found that in my application i have used ".xyz" type property files and directory to save some data, so in mac os "." prepended serve as hidden file.

它给出错误,如

Error: /Users/userxyz/Library/Application Support/.appdir/.propertydir/.logininfo (Permission denied)

java.io.IOException: Permission denied
    at java.io.UnixFileSystem.createFileExclusively(Native Method)
    at java.io.File.createNewFile(File.java:883)

有没有人有解决上述错误的解决方案?

Is there any one who have solution to resolve above error?

推荐答案


问题是在Mac OS中。

The problem is in Mac OS.

不,问题是没有权限写入 userxyz 目录。 Java WebStart 通常绰绰有余,但你应该至少遵循 Technical Q& QA1170:Mac OS X上的重要Java目录 。请注意用户首选项,用户数据和应用程序支持之间的区别,每个用户首​​选项都以 System.getProperty(user.home)为根。另请注意,默认情况下, java.util.Preferences 使用〜/ Library / Preferences / your.qualified.name 。此外,没有使用隐藏文件名的原因。

No, the problem is not having permission to write to the Library directory of userxyz. Java WebStart is usually more than sufficient, but you should at least follow the approach recommended in Technical Q&A QA1170: Important Java Directories on Mac OS X. Note the distinction between user preferences, user data and application support, each of which is rooted in System.getProperty("user.home"). Note also that, java.util.Preferences uses ~/Library/Preferences/your.qualified.name by default. In addition, there's no reason to use hidden file names.

这篇关于在mac中按应用程序(.jar)读取/写入文件时,权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆