java - 如何读取/写入嵌入在 jar 中的文件
问题描述
我在 jar 中有一个 config.properties 文件,我想在这个文件中读取和写入,以读取我使用的
def config = CodeGenerator.getResourceAsStream("/config.properties")
Properties props = new Properties()
props.load(config)
def patternId = props.patternId as Integer;
def groupId = props.patternGroupId as Integer;
...
props.store(???)
但我不知道如何在这个文件中写入我的属性值?
解决方案
推荐阅读
- docker - Docker Compose 与 NGINX 代理通过不工作
- python - pyinstaller如何在文件夹中包含.py
- delphi - Delphi FMX TListview - DynamicAppearance 模式 - 访问冲突问题
- c# - 在连接字符串中包含服务名称的语法是什么?
- image - 从 RGB 值重绘后,图像现在具有黄色色调
- c - 是否可以将函数的返回值作为 C 中主函数的返回值传递?
- mysql - 重命名 Django 模型时的最佳实践是什么?[数据库:MySQL、PostgreSQL 或 SQLite]
- excel - 是否可以使用 OpenXML SDK 创建加密的 Excel 文件
- fb-hydra - 确认递归实例化将允许分层对象实例化
- java - 使用 CommonsCli,我如何解析一个可以多次出现并且具有灵活数量的值的选项?