Java Desktop Application using SQLite installed by

2019-04-08 00:04发布

问题:

I am a beginner in programming Java Desktop Application interacting with databases. My goal is to make a simple java application which uses a database to store it's data locally. After some googling I found that SQLite/Derby would cover my needs.

I've googled SQLite and Derby and I found that in order to use them I need to install them on the computer through commands in terminal.

My question is how the application could be done so that at the end the client will be given a simple installer file which installs both Java Application and the SQLite/Derby Database avoiding doing any installations before.

Is that possible?

回答1:

I think the easyest for you is to use the database in embedded mode. Different databases could be use in this way :

  • Derby
  • SQLLite and for more details you could at this answer
  • HSQLDB

The database is packaged with your application jar, so you don't need to install it.



回答2:

You could write a script (e.g. bash script on UNIX) which checks if the DB is installed, installs it if needed and runs the .jar file of your program. On windows you can achieve the same with a batch script. So the user would only have to execute the script.