在 jpackaged Java 应用程序中部署可写属性文件
我有一个 Java 客户端应用程序,我将使用 jpackage
将其打包为独立应用程序。
但是应用程序有一个属性文件,应用程序必须读取和写入该文件。我最初尝试在 IDE 中执行此操作,但是当我打包应用程序时,它失败了,因为属性文件的位置实际上位于打包的 .jar 内部。
是否有规范/“正确”的方法来使用 jpackaged 应用程序维护可写属性文件?
I have a Java client application that I am going to package as a stand-alone application using jpackage
.
But the application has a Properties file which must be both read and written to by the application. My initial attempts to do this run in the IDE, but when I package the application it fails because the location of the properties file is actually located inside the packaged .jar.
Is there a canonical / "right" way to maintain a writable properties file with a jpackaged application?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将默认设置打包到您的应用程序中。在运行时,将它们的可写副本存储在已知文件位置,通常在用户主目录的子目录中:
有关确定系统应用程序配置目录的更多详细信息,请参阅 查找专用应用程序文件夹的位置。
Package default settings in your application. At runtime, store a writable copy of them in a known file location, typically in a directory that is a descendant of the user’s home directory:
For more details on determining a system’s application configuration directory, see Find place for dedicated application folder.