-3

I am successfully able to read and write to a file in eclipse. I am also able to read from a file in the jar. However, I am not able to write to the file in the jar. It is located in a class folder called res. I have also unzipped the jar file and it contains the file I need to write to but it is not modified after the first run.

How can I do this?

I have tried BufferedWriter and PrintWriter but no effect. I tried usingFileOutputStream but I cannot construct it using getClass().getResourceAsStream(path) as it returns an InputStream.

ARJAV GARG
  • 19
  • 9

1 Answers1

0

Jar is an archive, you are not supposed to write into the file of a jar. You write to a file outside and create a jar later.

ravthiru
  • 8,878
  • 2
  • 43
  • 52