Question

I am trying to create a java standalone program and was wondering if there is a way to have some sort of data storage within my jar?

You see, my initial idea was to use xml files within the jar for reading and writing stuff in. I had no problem reading stuff from the xml files but I was told you cant really edit/create new files within a jar.

I want it so when i send the executable jar to my friend, initial data I have put in will be in it already and then they can just add to or change the data. I find it pretty tricky as it has to be a form of data storage without the internet access or any need for my friend to install anything more.

Was it helpful?

Solution

I decided to go for sqlite in the end. It works exactly how i want it to work. I might look into javaDB in the future as it seems to have better SQL language support sqlite.org/cvstrac/wiki?p=SqliteVersusDerby

OTHER TIPS

As far as I know, JAR files are read-only, which cannot be rewritten to. My suggestion is to use MS Access database as your JAR's data keeper. As it is portable, the only weakness is that you have to bring both of your JAR and MDB files together (or put them in 1 folder).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top