使用 java.util.prefs.Preferences 保存/获取首选项会导致 BackingStoreException
声明后
private static Preferences systemPrefs = Preferences.systemNodeForPackage (SomeClass.class);
,以下代码行之一:
String someString = systemPrefs.put("someKey", "someValue");
String someString = systemPrefs.get("someKey", "someDefaultValue");
会导致此错误,该错误在其余的过程中会一遍又一遍地重复 程序执行:
java.util.prefs.FileSystemPreferencessyncWorld VARNING:无法刷新系统首选项:java.util.prefs.BackingStoreException:/etc/.java/.systemPrefs/edu创建失败。
我怀疑某处存在某种安全问题。
是否由于某种原因该问题是该计算机特有的?那里可以吗 难道还有其他原因吗?
After declaring
private static Preferences systemPrefs = Preferences.systemNodeForPackage (SomeClass.class);
, either one of these lines of code:
String someString = systemPrefs.put("someKey", "someValue");
String someString = systemPrefs.get("someKey", "someDefaultValue");
causes this error, which repeats itself over and over during the rest of the
program execution:
java.util.prefs.FileSystemPreferences syncWorld
VARNING: Couldn't flush system prefs: java.util.prefs.BackingStoreException: /etc/.java/.systemPrefs/edu create failed.
I suspect there is some kind of security issue somewhere.
Could it be that this problem is specific to this computer for some reason? Could there
be some other reason for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要
root
权限才能更新系统级首选项。普通用户应该只能更新用户级别的首选项。You need
root
privileges to update the system-level preferences. Normal users should only be able to update user-level preferences.