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
  • 166,747
  • 40
  • 210
  • 420
Killerpixler
  • 4,002
  • 10
  • 37
  • 78
  • 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
  • 156,572
  • 25
  • 250
  • 300
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.

Mohammad Adil
  • 44,013
  • 17
  • 87
  • 109