Java Web Start 是否提供默认程序文件夹?

发布于 2024-08-05 13:57:36 字数 144 浏览 2 评论 0 原文

对于 Java Web Start 是否有一个默认位置来存储和访问与我的程序相关的数据?或者我需要创建一个文件夹吗?对于Java Web Start(假设我没有程序文件夹),仅在Windows的Program Files、Mac的Applications等中创建是标准的吗?

For Java Web Start is there a default place to store and access data related to my program? Or do I need to create a folder? For Java Web Start (assuming I don't get a program folder) is it standard to just create on in Program Files for window, Applications for mac, etc?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

往日 2024-08-12 13:57:36

我将使用用户主目录中的子目录。例如 System.getProperty("user.home") + File.separator + ".myapp/"

但为此用户必须为 Web 启动应用程序添加额外的权限。

要持久保存,您可以使用 JDK 中包含的属性文件或 XmlEncoder。或者使用外部库,例如 XStreamXvantage简单框架,它很简单

xstream.save(anyObject)

I would use a subdirectory in the users home directory. E.g. System.getProperty("user.home") + File.separator + ".myapp/"

But for that the user has to add extra permissions for the a web start application.

To persist you can use a properties file or XmlEncoder which are included in the JDK. Or use external libraries like XStream, Xvantage or the simple framework where it is simple as

xstream.save(anyObject)
孤城病女 2024-08-12 13:57:36

除了首选项 API为了存储用户设置,可以在 javax.jnlp

对于您的具体要求 < code>PersistenceService 将特别有用。

或者,您可以简单地提供应用程序所需的所有数据作为 .jar 文件的一部分,在 .jnlp 文件中引用它们,并使用以下命令自定义下载它们的方式和时间: DownloadService< /代码>

In addition to the Preferences API for storing user settings there are a few services that can be found in the javax.jnlp package.

For your concrete requirement the PersistenceService would be particularly useful.

Alternatively you can simply provide all data that your application requires as part of your .jar files, reference them in your .jnlp file and customize how and when they are downloaded by using the DownloadService.

独自←快乐 2024-08-12 13:57:36

使用 webstart 没有特定的默认位置来存储和访问与程序相关的数据。然而,Java 确实有 首选项 API 提供一种独立于平台的存储配置方式,而无需担心特定的存储位置/格式。

There is no specific default place to store and access data related to your program with webstart. However Java does have the Preferences API to provide a platform independant way of storing configuration without worrying about the specific storage location/format.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文