0

I have a Swing application I want to package as a jar file. I also have a properties file that I store user set properties in.

Can I store this file inside the jar file and will the application automatically write into the jar file?

I want to avoid having two files, the jar and the properties external of it.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Killerpixler
  • 4,200
  • 11
  • 42
  • 82
  • Possibly related - [How can a Java program use files inside the .jar for read and write?](http://stackoverflow.com/q/5052311/418556) – Andrew Thompson Apr 08 '13 at 23:40

2 Answers2

0

You could, but that doesn't mean you should.

Instead, bundle a default properties file, but check for a user-specific set of properties.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
0

You can surely bundle properties file inside of jar , But one problem with that is, it will become kind of read-only. So you will not be able to write anything into it.

Adil Shaikh
  • 44,509
  • 17
  • 89
  • 111