storing data with executable JAR
if I have an executable JAR that needs to read and write from a text file so that users can customize the program, can I put the text file or any kind of database inside the JAR or does it have to go outside. Also, what is the best way to store such data, in a database or in a text file?
> if I have an executable JAR that needs to read and
> write from a text file so that users can customize
> the program, can I put the text file or any kind of
> database inside the JAR or does it have to go
> outside.
I think it's safe to say that you'd need to create a folder to keep your files in. i.e. the Jar won't get updated.
> Also, what is the best way to store such
> data, in a database or in a text file?
Depends, a small amount of simple data should go in a flat file, .txt is fine, whatever. If you have lots of (possibly complex) data and relationships between the data, etc. then you'd likely use a database.
> what is the simplest database that java can deal
> with? can it use an access, or open office database?
Access, oh, puhlease! Check out hsqldb, the 100% Java database:
http://hsqldb.org/
> thanks Hippolyte, but just for heck of it, does java
> provide support for access in its API?
Yes, through the JDBC, if you have an appropriate driver.