How can an app use files inside the JAR for read and write?

前端 未结 5 770
别那么骄傲
别那么骄傲 2020-11-21 23:09

I need to store data into files inside .jar file and read it again.

I know that I can use Class.getResourceAsStream() method but it returns an Inp

5条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-21 23:57

    This is not really supported. In principle, you could operate on the jar file, but there's no guarantee the new contents would be correctly loaded. Let your build tools manage the jar file -- and choose something else for persistent storage managed by your program itself. Like a file.

提交回复
热议问题