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

查看:29
本文介绍了替代 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 以从我的网页启动应用程序,但出现安全异常.为了摆脱这个异常,我必须提示用户授予权限.我拒绝这样做,因为我的应用程序没有做任何其他需要用户许可的事情.

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 ?

推荐答案

您可能想考虑使用 PersistenceServiceJava 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天全站免登陆