Java中首选项的替代方案 [英] Alternative to Preferences in Java

查看:111
本文介绍了Java中首选项的替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Java Preferences API 用于在swing / java应用程序中存储和检索小块信息。

I'm using the Java Preferences API to store and retrieve small pieces of information in a swing/java application.

现在我已经设置了Java Web start来从我的web启动应用程序页面,我得到一个安全例外。为了摆脱这个异常,我必须提示用户权限。我拒绝这样做,因为我的应用程序没有做任何需要用户许可的事情。

Now i have setup Java Web start to launch the application from my web page, and I get a security exception. In order to get rid of this exception, I'd have to prompt the user for permissions. And I refuse to do that because my application does nothing else that would require the user's permission.

这就是为什么我需要一个替代解决方案来存储来自一次执行的几个键值到另一个。某种饼干或其他什么。你知道吗?

That's why I need an alternative solution for storing a few key values from one execution to another. Some sort of cookie or whatever. Do you know any please ?

推荐答案

你可能想看一下使用 PersistenceService ,a Java Web Start 的功能提供了在客户端系统上本地存储数据的方法,即使对于那些应用程序也是如此正在受限制的执行环境中运行。可以在此处找到相关示例。和此处

You may want to look into using PersistenceService, a feature of Java Web Start that "provides methods for storing data locally on the client system, even for applications that are running in the restricted execution environment." Related examples may be found here and here.

这篇关于Java中首选项的替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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