首页 > 解决方案 > 如何读取/写入嵌入在 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(???)

但我不知道如何在这个文件中写入我的属性值?

标签: javagroovyproperties-file

解决方案


推荐阅读